# Wikipedia Scraper — Articles, Content & Pageviews (`hipersoft/wikipedia-scraper`) Actor

Search Wikipedia or look up exact articles and get the full plain-text content, summary, categories, image, Wikidata ID and monthly pageview trends. Any language. Great for research, RAG and AI datasets. No setup.

- **URL**: https://apify.com/hipersoft/wikipedia-scraper.md
- **Developed by:** [Hipersoft](https://apify.com/hipersoft) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.0005 / article scraped

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 Scraper — Full Article Text, Summaries & Pageviews, structured JSON

Search Wikipedia or look up exact article titles and get back clean, structured JSON — full plain-text article content, intro summary, categories, lead image, Wikidata ID and monthly pageview trends. Works in any language edition. Perfect for research, building RAG and AI training datasets, content analysis and tracking topic popularity over time.

![Wikipedia Scraper input — search terms, exact titles and language edition in the Apify Console](https://api.apify.com/v2/key-value-stores/SUfvnaFLd9z9eBCtV/records/wikipedia-scraper-input.png?v=2)

### Features

- 🔎 **Search + exact titles** — combine `searchTerms` (which pull matching articles) with exact `titles`; results are deduplicated by title.
- 🌍 **Any language** — set `language` to any Wikipedia edition code (`en`, `es`, `de`, `fr`, `ja`, …).
- 📄 **Full plain text** — toggle `fullText` for the complete article as clean plain text, or just the intro summary when off.
- 📈 **Pageview trends** — flip `includePageviews` to attach the last 6 months of monthly pageviews plus a `pageviewsTotal`.
- 🏷️ **Rich metadata** — visible categories, lead image URL, Wikidata ID, page ID, word count and last-modified timestamp on every record.
- ✂️ **Clean snippets** — search snippets are stripped of HTML and decoded from entities into readable text.
- 📊 **Scales per term** — take up to 500 articles from each search term with automatic pagination and retries.

### What you get

![Wikipedia Scraper output example — article text, summary, categories and pageviews as structured JSON](https://api.apify.com/v2/key-value-stores/SUfvnaFLd9z9eBCtV/records/wikipedia-scraper-output.png?v=5)

Each dataset row is one article:

```json
{
  "title": "Machine learning",
  "pageId": 233488,
  "url": "https://en.wikipedia.org/wiki/Machine_learning",
  "language": "en",
  "summary": "Machine learning (ML) is a field of study in artificial intelligence concerned with...",
  "text": "Machine learning (ML) is a field of study in artificial intelligence...\n\nHistory...",
  "wordCount": 9231,
  "categories": ["Machine learning", "Cybernetics", "Learning"],
  "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/.../example.svg",
  "wikidataId": "Q2539",
  "lastModified": "2024-11-20T14:03:12Z",
  "searchSnippet": "Machine learning is a field of study in artificial intelligence...",
  "pageviews": [
    { "month": "202502", "views": 412034 },
    { "month": "202503", "views": 398115 }
  ],
  "pageviewsTotal": 2410882
}
```

#### Output schema

| Field | Type | Description |
| --- | --- | --- |
| `title` | string | Article title. |
| `pageId` | integer | Wikipedia numeric page ID. |
| `url` | string (URL) | Canonical URL of the article. |
| `language` | string | Wikipedia language edition code (e.g. `en`). |
| `summary` | string | Intro summary of the article. |
| `text` | string | Full article body as clean plain text. |
| `wordCount` | integer | Number of words in the article text. |
| `categories` | array | Visible category labels for the article. |
| `imageUrl` | string (URL) | Link to the article's lead image. |
| `wikidataId` | string | Linked Wikidata entity ID. |
| `lastModified` | string (ISO date) | Timestamp the article was last edited. |
| `searchSnippet` | string | Plain-text search-result snippet. |
| `pageviews` | array | Monthly pageview counts as month/views objects. |
| `pageviewsTotal` | integer | Sum of pageviews over the returned months. |

### Input

```json
{
  "searchTerms": ["quantum computing", "climate change"],
  "titles": ["Alan Turing", "Python (programming language)"],
  "language": "en",
  "maxResultsPerSearch": 20,
  "fullText": true,
  "includePageviews": true
}
```

| Field | Description |
| --- | --- |
| `searchTerms` | Terms to search Wikipedia for; matching articles are scraped. |
| `titles` | Exact article titles to scrape, combined with any search results. |
| `language` | Wikipedia language edition code (e.g. `en`, `es`, `de`, `fr`, `ja`). |
| `maxResultsPerSearch` | How many articles to take from each search term (1–500). |
| `fullText` | Include the full plain-text article; if off, only the intro summary. |
| `includePageviews` | Attach the last 6 months of monthly pageviews per article. |

### Use cases

- Build clean, plain-text article corpora for RAG pipelines and AI training datasets.
- Track topic popularity over time using monthly pageview trends.
- Enrich entities with Wikidata IDs, categories and lead images.
- Compile multilingual reference content by running the same titles across language editions.

### Pricing

Pay-per-event: you're billed a small amount per run and per item scraped — you only pay for what you get. See the **Pricing** tab for current rates.

### FAQ

**How many articles can I scrape per run?**
Each search term can return up to 500 articles (`maxResultsPerSearch`), with automatic pagination and retries. You can also add any number of exact `titles`, and results are deduplicated by title.

**Can I scrape non-English Wikipedia?**
Yes. Set `language` to any Wikipedia edition code (`en`, `es`, `de`, `fr`, `ja`, …), and run the same titles across editions for multilingual corpora.

**What's the output format?**
Structured JSON — one record per article with `title`, `url`, `summary`, full plain-text `text`, `wordCount`, `categories`, `imageUrl`, `wikidataId` and optional monthly `pageviews`. Export as JSON, CSV, Excel or via the API.

**Can I get full article text and pageview trends?**
Yes. Toggle `fullText` for the complete cleaned plain text (or just the intro summary when off), and set `includePageviews` to attach the last 6 months of monthly pageviews plus a `pageviewsTotal`.

**Can I connect this to other apps and services?**
The Wikipedia Scraper can be connected with almost any cloud service or web app thanks to [integrations on the Apify platform](https://apify.com/integrations). It works with [Make](https://apify.com/integrations/make), [Zapier](https://apify.com/integrations/zapier), [Slack](https://docs.apify.com/platform/integrations/slack), [Airbyte](https://docs.apify.com/platform/integrations/airbyte), [GitHub](https://docs.apify.com/platform/integrations/github), [Google Drive](https://docs.apify.com/platform/integrations/drive) and [many more](https://apify.com/integrations), plus the [Apify API](https://docs.apify.com/api/v2), JavaScript/Python clients and MCP. Or use [webhooks](https://docs.apify.com/platform/integrations/webhooks) to trigger an action whenever a run finishes.

### Related Actors

Building research or RAG datasets? Combine this with our other reference and developer-data scrapers:

- [Stack Overflow & Stack Exchange Scraper](https://apify.com/hipersoft/stackexchange-scraper) — questions by tag or search across Stack Exchange sites.
- [Hacker News Scraper](https://apify.com/hipersoft/hacker-news-scraper) — stories, comments and Ask/Show HN by keyword and filters.
- [GitHub Scraper](https://apify.com/hipersoft/github-scraper) — repositories and user profiles with stars, topics, licenses and leads.
- [npm Package Scraper](https://apify.com/hipersoft/npm-scraper) — search and look up npm packages with metadata, dependencies and downloads.

### Notes

This Actor uses Wikipedia's public MediaWiki APIs and the Wikimedia pageviews API, returning that content as-is over openly available pages. Article text is available under Wikipedia's own licensing (typically CC BY-SA); check and comply with those terms for reuse. This is an independent tool and is not affiliated with, endorsed by, or sponsored by Wikipedia or the Wikimedia Foundation.

# Actor input Schema

## `searchTerms` (type: `array`):

Search Wikipedia for these terms and scrape the matching articles.

## `titles` (type: `array`):

Scrape these exact article titles, e.g. "Albert Einstein". Combined with any search results.

## `language` (type: `string`):

Wikipedia language edition (e.g. en, es, de, fr, ja).

## `maxResultsPerSearch` (type: `integer`):

How many articles to take from each search term.

## `fullText` (type: `boolean`):

Include the full plain-text article. If off, only the intro summary is returned.

## `includePageviews` (type: `boolean`):

Include the last 6 months of monthly pageviews for each article.

## Actor input object example

```json
{
  "searchTerms": [
    "quantum computing",
    "climate change"
  ],
  "titles": [
    "Alan Turing",
    "Python (programming language)"
  ],
  "language": "en",
  "maxResultsPerSearch": 20,
  "fullText": true,
  "includePageviews": true
}
```

# 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 = {
    "searchTerms": [
        "machine learning"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("hipersoft/wikipedia-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 = { "searchTerms": ["machine learning"] }

# Run the Actor and wait for it to finish
run = client.actor("hipersoft/wikipedia-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 '{
  "searchTerms": [
    "machine learning"
  ]
}' |
apify call hipersoft/wikipedia-scraper --silent --output-dataset

```

## MCP server setup

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