# Wikipedia Pageviews Scraper: Traffic & Trend Analysis (`arman-bd/wikipedia-pageviews-scraper`) Actor

Scrape Wikimedia pageview analytics: daily or monthly views for any article, by access method and agent type. A genuinely free proxy for public interest.

- **URL**: https://apify.com/arman-bd/wikipedia-pageviews-scraper.md
- **Developed by:** [Arman Hossain](https://apify.com/arman-bd) (community)
- **Categories:** Automation, AI, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.37 / 1,000 pageview scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Wikipedia Pageviews Scraper: Traffic & Trend Analysis

![Wikipedia Pageviews Scraper: Daily or monthly view counts for any Wikipedia article, with the total, peak day and trend already computed](https://api.apify.com/v2/key-value-stores/ZQOcNAOHrIgTacAmy/records/wikipedia-pageviews-scraper.jpg)

**Wikipedia Pageviews Scraper** pulls daily or monthly view counts for any Wikipedia article from the **Wikimedia Analytics API**, and returns each series with its total, its peak day and a trend figure already computed.

Pageviews are the closest thing to a free, public, unlogged search-volume signal: real attention, per topic, per day, back to 2015, in every language edition. This Actor reads the official analytics endpoint directly: **no proxy setup, no browser, no credentials to manage.**

**Agent skill: [SKILL.md](https://api.apify.com/v2/key-value-stores/t7YoTxpZEJOWvw4Ug/records/wikipedia-pageviews-scraper.md)**

```
https://api.apify.com/v2/key-value-stores/t7YoTxpZEJOWvw4Ug/records/wikipedia-pageviews-scraper.md
```

### What you get

**Series mode** (default), one record per article:

| Output field | Meaning |
|---|---|
| `article`, `project` | Underscore-encoded title and the Wikimedia project it came from |
| `granularity`, `accessMethod`, `agent` | The query that produced this series |
| `fromDate`, `toDate`, `dataPoints` | Window requested and how many points came back |
| `totalViews`, `averageViews` | Sum and mean across the window |
| `peakDate`, `peakViews` | Busiest day (or month) and its count |
| `trendPercent` | Second half of the window vs the first half, in per cent |
| `series` | The points themselves: `{ timestamp, date, views }` |
| `scrapedAt` | Run timestamp |

**Rows mode**, one record per data point, carrying its series' aggregates on every row: `article, project, granularity, timestamp, views, accessMethod, agent, totalViews, peakDate, peakViews, trendPercent, scrapedAt`. This is the shape that exports straight to CSV and drops into a chart.

A `RUN_SUMMARY` record in the key-value store holds per-run counts, the filters used, and any article that failed.

### Common use cases

- **Brand and topic monitoring.** Track public interest in a company, product or person over time.
- **News correlation.** Line up attention spikes with events and press coverage.
- **Free search-volume proxy.** A directional substitute for keyword tools, with no seat licence.
- **Content prioritisation.** Find which topics in your space people actually look up.
- **Seasonality analysis.** Pull `monthly` granularity over several years in one run.

### Quick start

Last month for two topics:

```json
{
 "articles": ["Web scraping", "Python (programming language)"],
 "fromDate": "20260101",
 "toDate": "20260131"
}
```

Five years of monthly seasonality, CSV-ready:

```json
{
 "articles": ["Christmas", "Halloween"],
 "project": "en.wikipedia",
 "fromDate": "2021-01-01",
 "toDate": "2026-01-01",
 "granularity": "monthly",
 "outputMode": "rows"
}
```

Mobile-only traffic on the German Wikipedia:

```json
{
 "articles": ["https://de.wikipedia.org/wiki/Kartoffel"],
 "fromDate": "20260101",
 "toDate": "20260131",
 "accessMethod": "mobile-web",
 "agent": "user"
}
```

### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| `articles` | array | - | **Required.** Titles or full Wikipedia URLs. A URL also sets that article's project. |
| `project` | string | `en.wikipedia` | Project for plain titles, `de.wikipedia`, `en.wikinews`, … |
| `fromDate` | string | 31 days ago | **Required.** `YYYYMMDD` or `YYYY-MM-DD`. |
| `toDate` | string | yesterday | **Required.** `YYYYMMDD` or `YYYY-MM-DD`. Data lags roughly a day. |
| `granularity` | string | `daily` | `daily` or `monthly`. |
| `accessMethod` | string | `all-access` | `all-access`, `desktop`, `mobile-web`, `mobile-app`. |
| `agent` | string | `user` | `user` excludes known bots, the honest interest signal. Also `all-agents`, `spider`, `automated`. |
| `outputMode` | string | `series` | `series` = one record per article; `rows` = one record per data point. |

### Output example

Series mode:

```json
{
 "article": "Web_scraping",
 "project": "en.wikipedia",
 "granularity": "daily",
 "accessMethod": "all-access",
 "agent": "user",
 "fromDate": "20260101",
 "toDate": "20260131",
 "dataPoints": 31,
 "totalViews": 15367,
 "averageViews": 496,
 "peakDate": "2026-01-23",
 "peakViews": 1068,
 "trendPercent": 2.9,
 "series": [
 { "timestamp": "2026010100", "date": "2026-01-01", "views": 249 },
 { "timestamp": "2026010200", "date": "2026-01-02", "views": 368 }
 ],
 "scrapedAt": "2026-08-06T11:44:00.000Z"
}
```

Rows mode:

```json
{
 "article": "Berlin",
 "project": "en.wikipedia",
 "granularity": "daily",
 "timestamp": "2026-01-01",
 "views": 3750,
 "accessMethod": "all-access",
 "agent": "user",
 "totalViews": 27726,
 "peakDate": "2026-01-07",
 "peakViews": 4701,
 "trendPercent": 11.2,
 "scrapedAt": "2026-08-06T11:44:00.000Z"
}
```

### API example

```bash
curl -X POST "https://api.apify.com/v2/acts/arman-bd~wikipedia-pageviews-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{
 "articles": ["Web scraping"],
 "fromDate": "20260101",
 "toDate": "20260131"
 }'
```

### JavaScript example

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

const client = new ApifyClient({ token: 'YOUR_TOKEN' });
const run = await client.actor('arman-bd/wikipedia-pageviews-scraper').call({
 articles: ['Christmas', 'Halloween'],
 fromDate: '2025-01-01',
 toDate: '2026-01-01',
 granularity: 'monthly',
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const s of items) console.log(`${s.article}: ${s.totalViews} views, peak ${s.peakViews} in ${s.peakDate}`);
```

### Limits and behaviour

- **Titles must match the URL form exactly.** A mismatched title returns 404 with no explanation, the API cannot tell "no such article" from "no data". The Actor normalises spaces to underscores and capitalises the first letter for you, but everything after that is case-sensitive: `Python (programming language)`, not `python (Programming Language)`. Pasting the article URL is the safest input.
- **`trendPercent` is second half vs first half** of the window you asked for, rounded to one decimal. It is `null` for series shorter than four points, or when the first half had zero views.
- **Data lags about a day**, so `toDate` defaults to yesterday rather than today.
- **Missing articles don't kill the run.** A 404 is recorded in `RUN_SUMMARY.failures` and the run continues; the Actor only errors out if *every* article fails.
- **Transient errors are retried.** 429 and 5xx get four attempts with exponential backoff and jitter.
- **Descriptive user agent.** Wikimedia throttles generic clients within a handful of requests; every request identifies this Actor.
- **Public, aggregate data only.** Pageview counts are anonymised aggregates, no user-level data exists in this API.

### FAQ

**Do I need a proxy?** No. Proxy configuration is not required to run this Actor.

**Do I need an account?** No. You supply no credentials.

**Is weekly granularity supported?** No, the per-article endpoint offers `daily` and `monthly` only. Aggregate daily points yourself if you need weeks.

**How far back does data go?** July 2015 for the pageviews API. Earlier traffic exists only in the legacy, differently-shaped `pagecounts` datasets.

**Why did an article return nothing?** Almost always the title. Check it against the URL on Wikipedia, or paste the full URL and let the Actor parse it.

**What happens if a source is unavailable?** It is reported in `RUN_SUMMARY.failures` and the run continues.

**Can I schedule it?** Yes, it is designed for scheduled runs. A daily run with a rolling 30-day window keeps a live trend table warm.

**Can I integrate it with something else?** Yes, Apify API, client libraries, webhooks, scheduled runs, dataset exports (JSON/CSV/Excel) or MCP. Output is structured JSON.

# Actor input Schema

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

Article titles or full Wikipedia URLs. Titles are matched exactly as they appear in the URL. spaces become underscores and the first letter is capitalised automatically. A URL also sets the project for that article.

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

Wikimedia project for articles given as plain titles, e.g. 'en.wikipedia', 'de.wikipedia', 'en.wikinews'.

## `fromDate` (type: `string`):

Start of the window. YYYYMMDD or YYYY-MM-DD. Defaults to 31 days ago.

## `toDate` (type: `string`):

End of the window. YYYYMMDD or YYYY-MM-DD. Defaults to yesterday. pageview data lags about a day.

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

One data point per day or per month. The per-article endpoint supports these two only.

## `accessMethod` (type: `string`):

Restrict to a platform, or combine them all.

## `agent` (type: `string`):

'user' excludes known bots and is the honest interest signal; 'all-agents' includes crawlers and automated traffic.

## `outputMode` (type: `string`):

'series' writes one record per article with the daily points nested under 'series'. 'rows' writes one record per data point, which exports straight to CSV for charting.

## Actor input object example

```json
{
  "articles": [
    "Python (programming language)",
    "https://de.wikipedia.org/wiki/Kartoffel"
  ],
  "project": "de.wikipedia",
  "fromDate": "2026-01-01",
  "toDate": "2026-01-31",
  "granularity": "daily",
  "accessMethod": "all-access",
  "agent": "user",
  "outputMode": "series"
}
```

# Actor output Schema

## `items` (type: `string`):

Every record the run produced.

## `runsummary` (type: `string`):

The RUN_SUMMARY record from the run's key-value store.

# 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 = {
    "articles": [
        "Web scraping",
        "Berlin"
    ],
    "project": "en.wikipedia",
    "fromDate": "20260101",
    "toDate": "20260131"
};

// Run the Actor and wait for it to finish
const run = await client.actor("arman-bd/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 = {
    "articles": [
        "Web scraping",
        "Berlin",
    ],
    "project": "en.wikipedia",
    "fromDate": "20260101",
    "toDate": "20260131",
}

# Run the Actor and wait for it to finish
run = client.actor("arman-bd/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 '{
  "articles": [
    "Web scraping",
    "Berlin"
  ],
  "project": "en.wikipedia",
  "fromDate": "20260101",
  "toDate": "20260131"
}' |
apify call arman-bd/wikipedia-pageviews-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,arman-bd/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/fcYCWhrN8HA6Syh2z/builds/7NzhGHhBGnD7SKVDz/openapi.json
