# Wikipedia Pageviews & Article Data (`grit-77/wikipedia-pageviews`) Actor

Wikipedia pageview data from Wikimedia public endpoints. Export traffic series, top articles or current summaries as JSON with source URLs; counts measure requests, not unique people.

- **URL**: https://apify.com/grit-77/wikipedia-pageviews.md
- **Developed by:** [Grit](https://apify.com/grit-77) (community)
- **Categories:** AI, Marketing
- **Stats:** 3 total users, 2 monthly users, 78.6% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.25 / 1,000 pageview rows

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/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 & Article Data

Wikipedia pageviews API returns article traffic series, top articles, or current article summaries from Wikimedia public endpoints. Wikipedia traffic scraper output includes source URLs, retrieval status, and summary metadata when requested.

### What it does

Use `pageviews` for traffic over a date range, `top` for ranked pages, or `summary` for article descriptions. Series rows include request counts, not unique people. Summary text is current at retrieval time even when traffic dates are historical.

### Input example

```json
{
  "mode": "pageviews",
  "projects": [
    "en.wikipedia.org"
  ],
  "articles": [
    "Albert_Einstein"
  ],
  "startDate": "2025-09-01",
  "endDate": "2025-09-03",
  "maxItems": 1
}
```

The example uses fields defined in the actor input schema. Other filters can be set in the Apify input form.

### Output fields

Examples below come from [sample_output.json](sample_output.json); long strings and arrays are shown as excerpts. Modes and error rows can have different fields.

| Field | Type in sample | Example value |
|---|---|---|
| `mode` | string | `"pageviews"` |
| `project` | string | `"en.wikipedia.org"` |
| `article` | string | `"Albert_Einstein"` |
| `title` | string | `"Albert Einstein"` |
| `article_url` | string | `"https://en.wikipedia.org/wiki/Albert_Einstein"` |
| `status` | string | `"ok"` |
| `errors` | array | `[]` |
| `fetched_at` | string | `"2026-10-05T12:46:18.504153+00:00"` |
| `start_date` | string | `"2025-09-01"` |
| `end_date` | string | `"2025-09-03"` |
| `access` | string | `"all-access"` |
| `agent` | string | `"user"` |
| `granularity` | string | `"daily"` |
| `pageviews` | array | `[{"date": "2025-09-01", "views": 12007}, {"date": "2025-09-02", "views": 12422}, {…` |
| `total_views` | number | `36343` |
| `average_views` | number | `12114.333333333334` |
| `peak_date` | string | `"2025-09-02"` |
| `peak_views` | number | `12422` |
| `periods` | number | `3` |
| `source_url` | string | `"https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia.org/…` |
| `summary` | string | `"Albert Einstein was a German-born theoretical physicist best known for developing…` |
| `description` | string | `"German-born theoretical physicist (1879–1955)"` |
| `page_id` | number | `736` |
| `wikidata_id` | string | `"Q937"` |
| `summary_type` | string | `"standard"` |
| `thumbnail_url` | string | `"https://thumb.wikimedia.org/wikipedia/commons/thumb/2/28/Albert_Einstein_Head_cle…` |
| `revision` | string | `"1376862306"` |
| `last_modified` | string | `"2026-09-26T17:36:25Z"` |
| `attribution` | string | `"Wikipedia contributors; see article_url for page history and licensing."` |
| `summary_source_url` | string | `"https://en.wikipedia.org/api/rest_v1/page/summary/Albert_Einstein"` |

| `date` | string | `"2025-09-01"` |
| `rank` | number | `3` |
| `views` | number | `339418` |

### Output example

A trimmed record copied from [sample_output.json](sample_output.json):

```json
{
  "mode": "pageviews",
  "project": "en.wikipedia.org",
  "article": "Albert_Einstein",
  "title": "Albert Einstein",
  "article_url": "https://en.wikipedia.org/wiki/Albert_Einstein",
  "status": "ok",
  "start_date": "2025-09-01",
  "end_date": "2025-09-03",
  "pageviews": [
    {
      "date": "2025-09-01",
      "views": 12007
    },
    {
      "date": "2025-09-02",
      "views": 12422
    },
    {
      "date": "2025-09-03",
      "views": 11914
    }
  ],
  "total_views": 36343,
  "average_views": 12114.333333333334,
  "peak_date": "2025-09-02",
  "peak_views": 12422,
  "periods": 3,
  "source_url": "https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia.org/all-access/user/Albert_Einstein/daily/2025090100/2025090300",
  "summary": "Albert Einstein was a German-born theoretical physicist best known for developing the theory of relativity. Einstein also made important contributions to quantum theory. His mass–energy equivalence formula E = mc2, which arises from special relativity, has been called \"the world's most famous equation\". He received the 1921 Nobel Prize in Physics for \"his services to theoretical physics, and especially for his discovery of the law of the photoelectric effect\".",
  "last_modified": "2026-09-26T17:36:25Z",
  "fetched_at": "2026-10-05T12:46:18.504153+00:00",
  "errors": []
}
```

### FAQ

**What date and row limits apply?** Traffic starts at 2015-07-01 and ends no later than yesterday UTC. A requested range can span at most 366 days. `maxItems` caps dataset rows, including errors.

**Do I need an API key, proxy, or login?** No source API key or login is required. Requests use direct HTTP. Supply a valid `contact` when you want it included in the descriptive User-Agent.

**What is the pricing model?** The proposed `row` event costs $0.00025 per usable traffic, top, or summary row. Failed rows are not charged. The owner must configure this event in Apify before publication.

**How are rate limits handled?** Transient network, HTTP 429, and server errors get at most three attempts. The client honors `Retry-After` up to 60 seconds.

**How fresh are pageviews and summaries?** Wikimedia traffic may arrive after a requested date, and a missing period is not filled with zero. Summaries reflect the current article revision; compare `last_modified` with `fetched_at`.

### Use with AI agents / MCP

After this actor is available to your account, configure it as an actor tool in the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp), or start a run through the [Apify API](https://docs.apify.com/api/v2) with the same input JSON. Give the agent the actor identifier and access through your Apify credentials. Read the completed run’s default dataset through the returned run or dataset reference, check error fields before using records, and keep source URLs with quoted data. Limit the input to the task the agent is answering.

### Source and reuse notes

Top-mode special-page filtering uses title heuristics and keeps original ranks. Redirects and language editions have separate traffic. Keep `article_url` for attribution and check the source page and image licensing before reuse. See [Wikimedia pageview reference](https://doc.wikimedia.org/generated-data-platform/aqs/analytics-api/reference/page-views.html) and [User-Agent policy](https://foundation.wikimedia.org/wiki/Policy:Wikimedia_Foundation_User-Agent_Policy).

# Actor input Schema

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

pageviews: one article row containing its complete series. top: one row per ranked article/day/project. summary: article extracts and metadata.

## `contact` (type: `string`):

Optional. Sent to Wikimedia in the User-Agent as its policy recommends; leave empty to use the actor's own contact URL. Not included in results.

## `projects` (type: `array`):

1-20 domains such as en.wikipedia.org or tr.wikipedia.org. Article titles are looked up on each project; article URLs must match that project. REST summaries are available only on projects exposing that endpoint.

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

Required for pageviews and summary modes; ignored for top mode. Duplicates after title normalization are removed per project. Invalid individual titles become uncharged error rows. At most 10000 input entries.

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

YYYY-MM-DD, from 2015-07-01 through yesterday UTC. Default: seven completed days for pageviews, yesterday for top. Monthly mode uses the first day of the previous completed month. Ignored for summary mode.

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

YYYY-MM-DD. Default: yesterday UTC; monthly mode uses the first day of the previous completed month. Maximum inclusive range: 366 days. Ignored for summary mode.

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

Pageviews only. Monthly mode requires first-of-month start/end dates for completed months. Top mode always uses daily rankings.

## `access` (type: `string`):

Device/access channel for pageviews and daily top articles.

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

Pageviews only: user (human traffic), spider, automated or all-agents. Wikimedia top rankings use user traffic.

## `topLimit` (type: `integer`):

Ranked rows requested per day/project, after optional filtering. Also limited by maxItems across the entire run.

## `excludeSpecialPages` (type: `boolean`):

Top mode: exclude Main_Page and titles containing a colon. This is a title heuristic; localized main pages and colon-bearing article titles may need it turned off. Original ranks remain unchanged.

## `includeSummary` (type: `boolean`):

Enrich pageviews/top rows with the current summary, description, page ID, Wikidata ID and image URL for the same row price. A failed summary keeps traffic and adds an error. Summary mode always fetches summaries.

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

Hard dataset row cap for the entire run, including error rows. A pageviews row contains the whole date range; top rows represent one article/day.

## `concurrency` (type: `integer`):

Maximum simultaneous article jobs/requests. Keep low to respect Wikimedia; transient failures retry with backoff.

## Actor input object example

```json
{
  "mode": "pageviews",
  "projects": [
    "en.wikipedia.org"
  ],
  "articles": [
    "Albert Einstein",
    "Ada Lovelace"
  ],
  "granularity": "daily",
  "access": "all-access",
  "agent": "user",
  "topLimit": 10,
  "excludeSpecialPages": true,
  "includeSummary": true,
  "maxItems": 1000,
  "concurrency": 3
}
```

# Actor output Schema

## `dataset` (type: `string`):

Open the collected Wikimedia results and error rows.

# 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": [
        "Albert Einstein",
        "Ada Lovelace"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("grit-77/wikipedia-pageviews").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": [
        "Albert Einstein",
        "Ada Lovelace",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("grit-77/wikipedia-pageviews").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": [
    "Albert Einstein",
    "Ada Lovelace"
  ]
}' |
apify call grit-77/wikipedia-pageviews --silent --output-dataset

```

## MCP server setup

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

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/qm95ik5B41h0AJYOQ/builds/sJ1AbSMKncI8qDAtB/openapi.json
