# Wikipedia Pageviews Scraper - Article Traffic & Top Pages (`ninhothedev/wikipedia-pageviews-scraper`) Actor

$0.5/1K 🔥 Fast Wikipedia pageviews scraper! Article traffic stats & daily top articles by project. No key. JSON, CSV, Excel or API in seconds. Enter articles or dates & pull thousands of views for trend & SEO analysis ⚡

- **URL**: https://apify.com/ninhothedev/wikipedia-pageviews-scraper.md
- **Developed by:** [ninhothedev](https://apify.com/ninhothedev) (community)
- **Categories:** News, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Wikipedia Pageviews Scraper

**Scrape Wikipedia pageview statistics and the daily top-viewed articles — fast, structured, and key-free.** This Apify actor pulls article traffic data straight from the official [Wikimedia REST Pageviews API](https://wikimedia.org/api/rest_v1/) and returns clean JSON/CSV rows you can drop into a dashboard, spreadsheet, or data warehouse.

Track how many people read a Wikipedia article each day or month, or discover what the whole world was reading on any given day. No API key, no login, no scraping fragile HTML.

***

### Features

- **Per-article pageviews** — daily or monthly traffic for any list of articles over any date range.
- **Top viewed articles** — the most-read Wikipedia pages for any day (up to 1,000 per day) or a whole month.
- **Any language / project** — `en.wikipedia`, `de.wikipedia`, `es.wikipedia`, `fr.wikipedia`, and every other Wikimedia project.
- **Clean, typed output** — one row per data point, ISO dates, integer view counts.
- **No API key required** — uses the free official Wikimedia REST API with a descriptive User-Agent.
- **Datacenter-proxy friendly** — runs cheaply without residential proxies.

***

### Modes

#### `article` — per-article pageviews

Provide a `project`, a list of `articles`, a `granularity` (`daily` or `monthly`), and a `startDate`/`endDate` (YYYYMMDD). You get one row per article per timestamp.

#### `top` — top viewed articles

Provide a `project` and a `topYear` / `topMonth` / `topDay`. Use a specific day (e.g. `01`) for that day's ranking, or leave `topDay` empty / set it to `all-days` for every day in the month.

***

### Input

| Field | Type | Description |
|-------|------|-------------|
| `mode` | select | `article` or `top`. |
| `project` | string | Wikimedia project, e.g. `en.wikipedia`. Default `en.wikipedia`. |
| `articles` | array | Article titles (article mode). Default `["Python_(programming_language)", "Artificial_intelligence"]`. |
| `granularity` | select | `daily` or `monthly` (article mode). Default `daily`. |
| `startDate` | string | Range start `YYYYMMDD` (article mode). |
| `endDate` | string | Range end `YYYYMMDD` (article mode). |
| `topYear` | string | Year (top mode), e.g. `2024`. |
| `topMonth` | string | Two-digit month (top mode), e.g. `01`. |
| `topDay` | string | Two-digit day or `all-days` (top mode). |
| `maxItems` | integer | Max output rows. Default `1000`, max `10000`. |

#### Example input (article mode)

```json
{
  "mode": "article",
  "project": "en.wikipedia",
  "articles": ["Python_(programming_language)", "Artificial_intelligence"],
  "granularity": "daily",
  "startDate": "20240101",
  "endDate": "20240131"
}
```

#### Example input (top mode)

```json
{
  "mode": "top",
  "project": "en.wikipedia",
  "topYear": "2024",
  "topMonth": "01",
  "topDay": "01"
}
```

***

### Output

**Article mode**

```json
{
  "project": "en.wikipedia",
  "article": "Python_(programming_language)",
  "timestamp": "2024-01-01",
  "granularity": "daily",
  "views": 8763,
  "scraped_at": "2024-06-22T10:00:00+00:00"
}
```

**Top mode**

```json
{
  "project": "en.wikipedia",
  "article": "Main_Page",
  "rank": 1,
  "views": 4817450,
  "date": "2024-01-01",
  "scraped_at": "2024-06-22T10:00:00+00:00"
}
```

Export as JSON, CSV, Excel, or via the Apify API.

***

### Use cases

- **Trend analysis** — spot spikes in interest around events, launches, and news.
- **SEO & content strategy** — see which topics attract attention and time your content.
- **Academic research** — study attention, information demand, and cultural trends.
- **Content planning** — mine daily top articles for ideas that are already popular.

***

### Pricing & cost

This actor is lightweight and cheap to run. As a rule of thumb it costs about **$0.5 per 1,000 result rows**, plus minimal platform compute. A typical per-article run over a month, or one day of top articles, costs only a few cents. Actual cost depends on your Apify plan and the number of rows you request (`maxItems`).

***

### Comparison

| | Wikipedia Pageviews Scraper | Manual API calls | HTML scraping |
|---|---|---|---|
| API key required | No | No | No |
| Structured JSON/CSV | Yes | Raw JSON only | Fragile |
| Top + per-article in one tool | Yes | DIY | No |
| Date-range batching | Yes | DIY | No |
| Any project/language | Yes | Yes | Varies |
| Maintenance | Managed | You | Constant |

***

### Related actors

- [Wikipedia Scraper](https://apify.com/ninhothedev/wikipedia-scraper) — full article content & metadata.
- [Wikidata Scraper](https://apify.com/ninhothedev/wikidata-scraper) — structured entity data.
- [Google News Scraper](https://apify.com/ninhothedev/google-news-scraper) — news headlines & articles.
- [GDELT News Scraper](https://apify.com/ninhothedev/gdelt-news-scraper) — global news events dataset.

***

### Support

Questions, feature requests, or issues? Reach out via the Apify contact form on the actor page. We respond quickly and welcome feedback.

***

**Keywords:** wikipedia pageviews, wikipedia traffic, article views, wikimedia api, top articles, pageview statistics, wikipedia analytics, trend analysis, wikipedia scraper, page view data

# Actor input Schema

## `mode` (type: `string`):

Choose 'article' to fetch per-article pageview time series over a date range, or 'top' to fetch the most-viewed articles of a given day/month.

## `project` (type: `string`):

Wikimedia project / language edition to query, e.g. 'en.wikipedia', 'de.wikipedia', 'es.wikipedia'.

## `articles` (type: `array`):

List of Wikipedia article titles to fetch pageviews for (used in 'article' mode). Use underscores or spaces; e.g. 'Python\_(programming\_language)'.

## `granularity` (type: `string`):

Time granularity of the per-article series (used in 'article' mode): 'daily' or 'monthly'.

## `startDate` (type: `string`):

Start date for the per-article range (used in 'article' mode) in YYYYMMDD format, e.g. '20240101'.

## `endDate` (type: `string`):

End date for the per-article range (used in 'article' mode) in YYYYMMDD format, e.g. '20240131'.

## `topYear` (type: `string`):

Year for the top-articles query (used in 'top' mode), e.g. '2024'.

## `topMonth` (type: `string`):

Month for the top-articles query (used in 'top' mode) as a two-digit number, e.g. '01'.

## `topDay` (type: `string`):

Day for the top-articles query (used in 'top' mode) as a two-digit number, e.g. '01'. Leave empty or use 'all-days' to get all days of the month.

## `maxItems` (type: `integer`):

Maximum number of dataset rows to output across all articles/days. Protects against very large runs.

## Actor input object example

```json
{
  "mode": "article",
  "project": "en.wikipedia",
  "articles": [
    "Python_(programming_language)",
    "Artificial_intelligence"
  ],
  "granularity": "daily",
  "startDate": "20240101",
  "endDate": "20240131",
  "topYear": "2024",
  "topMonth": "01",
  "topDay": "01",
  "maxItems": 1000
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "project": "en.wikipedia",
    "articles": [
        "Python_(programming_language)",
        "Artificial_intelligence"
    ],
    "startDate": "20240101",
    "endDate": "20240131",
    "topYear": "2024",
    "topMonth": "01",
    "topDay": "01"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ninhothedev/wikipedia-pageviews-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "project": "en.wikipedia",
    "articles": [
        "Python_(programming_language)",
        "Artificial_intelligence",
    ],
    "startDate": "20240101",
    "endDate": "20240131",
    "topYear": "2024",
    "topMonth": "01",
    "topDay": "01",
}

# Run the Actor and wait for it to finish
run = client.actor("ninhothedev/wikipedia-pageviews-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "project": "en.wikipedia",
  "articles": [
    "Python_(programming_language)",
    "Artificial_intelligence"
  ],
  "startDate": "20240101",
  "endDate": "20240131",
  "topYear": "2024",
  "topMonth": "01",
  "topDay": "01"
}' |
apify call ninhothedev/wikipedia-pageviews-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ninhothedev/wikipedia-pageviews-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/FoExRTah9tDR66SMD/builds/p1SysV0pDIPuiE4Bv/openapi.json
