# Wikipedia Trends Scraper: Top Articles by Country (`scrapemint/wikipedia-trends-scraper`) Actor

What every country is looking up on Wikipedia: daily top 1000 most-viewed articles per country or language, with rank movement between runs, plus daily view timeseries for any article. Official Wikimedia API, real view counts. For SEO, content, news and market signals. Keyless.

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

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 Trends Scraper: Top Articles by Country

Wikipedia is where the world goes to look things up, and its view counts are public, real numbers, not an index. This actor pulls the daily most-viewed articles for any country or language edition (up to 1000 ranks), and daily view histories for any list of articles. Straight from Wikimedia's official pageviews API. No login, no API key, no subscription.

Google Trends tells you a topic is rising on a 0 to 100 scale. Wikipedia tells you how many people actually looked it up, per day, per country. Together they are a complete attention dataset; pair this with the [Google Trends Scraper](https://apify.com/scrapemint/google-trends-scraper) and [Google News Scraper](https://apify.com/scrapemint/google-news-scraper).

### What you get

**Top mode** — one row per ranked article per chart:

| Field | Description |
|---|---|
| `scope`, `country` / `project` | Chart identity: a country (all languages combined) or a language edition (worldwide) |
| `date` | The day the chart is for (stats publish with about one day of lag) |
| `rank`, `views` | Position and real view count |
| `previousRank`, `rankChange`, `isNew` | Movement versus your previous run (with compare on) |
| `article`, `articleKey`, `articleUrl` | Title, raw key, and link |

**Timeseries mode** — one row per article per day: `article`, `date`, `views`, `project`, `articleUrl`.

Non-article noise (Main Page, search pages, meta namespaces) is filtered out by default so charts contain real topics.

### Input

- **Top mode**: country codes (`US, GB, DE, IN, BR, KE, ...`) and/or wiki projects (`en.wikipedia, ja.wikipedia`), chart depth up to 1000, optional specific date, movement tracking on a schedule.
- **Timeseries mode**: article titles, language edition, up to 365 days back.
- **Max rows per run**: cost cap.

### Pricing

Pay per result: **$0.003 per row**. First 2 rows of every run are free.

The daily top 100 for 5 countries is $1.50 a run. A 90-day view history for 20 articles is $5.40, once.

### Typical uses

- **SEO and content teams**: topic demand with real absolute numbers; catch topics whose attention is climbing before search volume tools update.
- **Newsrooms and newsletters**: "what the world looked up this week" formats, per market, automated.
- **Traders and analysts**: attention spikes on companies, products, people and events as a signal input.
- **Brand and PR monitoring**: daily views on your company's article versus competitors.
- **Researchers**: clean per-country attention data with no API key paperwork.

### Scheduling

Run top mode daily with "Compare with previous run" on: rank history is kept per chart in a named key-value store, so every run reports movers, new entries and exact view counts. Consume rows via the API, webhooks, or the Google Sheets integration.

### Data notes

Data comes from the official Wikimedia pageviews API and counts human (user) traffic only, excluding known bots and spiders. Daily stats publish with roughly one day of lag; the actor automatically steps back to the newest published day when no date is given.

# Actor input Schema

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

"Top articles" returns a ranked chart per country or language project for one day. "Article timeseries" returns daily views per article over a date range.
## `countries` (type: `array`):

ISO country codes, e.g. US, GB, DE, IN, BR, KE. One chart per country (all languages combined).
## `projects` (type: `array`):

Language projects instead of / in addition to countries, e.g. en.wikipedia, de.wikipedia, ja.wikipedia. One chart per project (worldwide views).
## `date` (type: `string`):

YYYY-MM-DD. Empty = latest published day (stats lag about one day; the actor steps back automatically).
## `topN` (type: `integer`):

How many ranked articles per chart (API serves up to 1000).
## `excludeSpecialPages` (type: `boolean`):

Skip Main Page, search pages and other non-article namespaces so charts contain real topics.
## `compareWithPrevious` (type: `boolean`):

Remember ranks between runs and report previousRank, rankChange and isNew. Turn on with a schedule for daily movement tracking.
## `articles` (type: `array`):

Article titles exactly as on Wikipedia, e.g. Bitcoin, Taylor Swift, ChatGPT.
## `project` (type: `string`):

Which language edition to read views from, e.g. en.wikipedia, es.wikipedia.
## `daysBack` (type: `integer`):

Length of the daily view history per article (up to 365).
## `maxRows` (type: `integer`):

Cap on rows returned. Controls total cost.

## Actor input object example

```json
{
  "mode": "top",
  "countries": [
    "US",
    "GB"
  ],
  "projects": [],
  "date": "",
  "topN": 50,
  "excludeSpecialPages": true,
  "compareWithPrevious": true,
  "articles": [],
  "project": "en.wikipedia",
  "daysBack": 30,
  "maxRows": 500
}
````

# 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 = {
    "mode": "top",
    "countries": [
        "US",
        "GB"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapemint/wikipedia-trends-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 = {
    "mode": "top",
    "countries": [
        "US",
        "GB",
    ],
}

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

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

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

```

## CLI example

```bash
echo '{
  "mode": "top",
  "countries": [
    "US",
    "GB"
  ]
}' |
apify call scrapemint/wikipedia-trends-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=scrapemint/wikipedia-trends-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Wikipedia Trends Scraper: Top Articles by Country",
        "description": "What every country is looking up on Wikipedia: daily top 1000 most-viewed articles per country or language, with rank movement between runs, plus daily view timeseries for any article. Official Wikimedia API, real view counts. For SEO, content, news and market signals. Keyless.",
        "version": "0.1",
        "x-build-id": "ipJnjBDc5zODnTuOm"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapemint~wikipedia-trends-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapemint-wikipedia-trends-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/scrapemint~wikipedia-trends-scraper/runs": {
            "post": {
                "operationId": "runs-sync-scrapemint-wikipedia-trends-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/scrapemint~wikipedia-trends-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-scrapemint-wikipedia-trends-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "top",
                            "timeseries"
                        ],
                        "type": "string",
                        "description": "\"Top articles\" returns a ranked chart per country or language project for one day. \"Article timeseries\" returns daily views per article over a date range.",
                        "default": "top"
                    },
                    "countries": {
                        "title": "Countries (top mode)",
                        "type": "array",
                        "description": "ISO country codes, e.g. US, GB, DE, IN, BR, KE. One chart per country (all languages combined).",
                        "default": [
                            "US",
                            "GB"
                        ],
                        "items": {
                            "type": "string"
                        }
                    },
                    "projects": {
                        "title": "Wiki projects (top mode, optional)",
                        "type": "array",
                        "description": "Language projects instead of / in addition to countries, e.g. en.wikipedia, de.wikipedia, ja.wikipedia. One chart per project (worldwide views).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "date": {
                        "title": "Date (top mode, optional)",
                        "type": "string",
                        "description": "YYYY-MM-DD. Empty = latest published day (stats lag about one day; the actor steps back automatically).",
                        "default": ""
                    },
                    "topN": {
                        "title": "Chart depth (top mode)",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "How many ranked articles per chart (API serves up to 1000).",
                        "default": 50
                    },
                    "excludeSpecialPages": {
                        "title": "Exclude non-article pages (top mode)",
                        "type": "boolean",
                        "description": "Skip Main Page, search pages and other non-article namespaces so charts contain real topics.",
                        "default": true
                    },
                    "compareWithPrevious": {
                        "title": "Compare with previous run (top mode)",
                        "type": "boolean",
                        "description": "Remember ranks between runs and report previousRank, rankChange and isNew. Turn on with a schedule for daily movement tracking.",
                        "default": true
                    },
                    "articles": {
                        "title": "Articles (timeseries mode)",
                        "type": "array",
                        "description": "Article titles exactly as on Wikipedia, e.g. Bitcoin, Taylor Swift, ChatGPT.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "project": {
                        "title": "Wiki project (timeseries mode)",
                        "type": "string",
                        "description": "Which language edition to read views from, e.g. en.wikipedia, es.wikipedia.",
                        "default": "en.wikipedia"
                    },
                    "daysBack": {
                        "title": "Days back (timeseries mode)",
                        "minimum": 1,
                        "maximum": 365,
                        "type": "integer",
                        "description": "Length of the daily view history per article (up to 365).",
                        "default": 30
                    },
                    "maxRows": {
                        "title": "Max rows per run",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Cap on rows returned. Controls total cost.",
                        "default": 500
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
