# Wikipedia Article Scraper (`dabooti/wikipedia-article-scraper`) Actor

Search Wikipedia in any language or give article titles and export clean data: summary, full plain text, word count, categories, Wikidata ID, main image, last edit date and 30-day page views. Official API, no login or key.

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

## Pricing

from $1.00 / 1,000 articles

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 Article Scraper

Search Wikipedia in any language, or give a list of article titles or URLs, and export clean article data to JSON, CSV or Excel: the short description, lead summary, full article as plain text, word count, categories, Wikidata ID, main image, last edit date and, optionally, human page views over the last 30 days.

It uses the official MediaWiki API and the Wikimedia Pageviews API. No login, API key or proxy needed.

### What you can use it for

- **AI and RAG datasets**: collect clean plain-text articles on a topic for embeddings, fine-tuning or retrieval.
- **Research and education**: export every article that matches a subject, with categories and Wikidata IDs for linking.
- **Content and SEO research**: see which topics get the most page views and how long and recently edited the articles are.
- **Entity enrichment**: turn a list of company, person or place names into descriptions, images and Wikidata IDs.
- **Multilingual work**: run the same query on de, fr, es, ja or any other Wikipedia edition.

### What data you get

| Field | Description |
|---|---|
| `title`, `pageId`, `url`, `language` | Article title, page ID, link and language edition |
| `description` | Short description (from Wikidata) |
| `summary` | Lead section as plain text |
| `text`, `wordCount` | Full article as plain text and its word count (when "Include full article text" is on) |
| `lengthBytes` | Size of the article source |
| `lastEditedAt` | Time of the latest edit |
| `categories` | Visible categories (hidden maintenance categories are left out) |
| `isDisambiguation` | True for disambiguation pages |
| `wikidataId` | Wikidata item, for example Q2539 |
| `imageUrl` | Main article image |
| `pageviews30d` | Human page views over the last 30 days (when enabled) |
| `requestedAs`, `query`, `scrapedAt` | The title you asked for if it redirected, the matching query and the scrape time |

### How to use it

1. Add **Search queries**, or a list of **Article titles or URLs**, or both.
2. Pick the **Wikipedia language** (default `en`).
3. Set **Max articles per query**, and choose whether to include full text and page views.
4. Click **Start** and export from the **Output** tab.

#### Example input

```json
{
  "searchQueries": ["renewable energy", "battery storage"],
  "articles": ["https://en.wikipedia.org/wiki/Alan_Turing", "Grace Hopper"],
  "language": "en",
  "maxArticlesPerQuery": 100,
  "includeFullText": true,
  "includePageviews": true
}
```

#### Example output

One record from a real run (full text shortened):

```json
{
  "title": "Machine learning",
  "pageId": 233488,
  "language": "en",
  "url": "https://en.wikipedia.org/wiki/Machine_learning",
  "description": "Subset of artificial intelligence",
  "summary": "Machine learning (ML) is a field of study in artificial intelligence concerned with the development and study of statistical algorithms that can learn from  data and generalize to unseen data, and thus perform tasks without being explicitly programmed.\nStatistics and mathematical optimisation method...",
  "text": "Machine learning (ML) is a field of study in artificial intelligence concerned with the development and study of statistical algorithms that can learn from  data and generalize to unseen data, and thus perform tasks without being explicitly programmed.\nStatistics and mathematical optimisation method...",
  "wordCount": 8573,
  "lengthBytes": 147085,
  "lastEditedAt": "2026-11-07T20:01:34Z",
  "categories": [
    "Cybernetics",
    "Data science",
    "Definition",
    "Learning",
    "Machine learning"
  ],
  "isDisambiguation": false,
  "wikidataId": "Q2539",
  "imageUrl": null,
  "pageviews30d": null,
  "requestedAs": null,
  "query": "machine learning",
  "scrapedAt": "2026-11-16T15:25:50.282Z"
}
```

### Pricing

Pay per event: **$1.00 per 1,000 articles** saved, plus a tiny standard start fee and Apify platform usage (usually a fraction of a cent per run). An article found by several queries is saved and charged once. Set **Max cost per run** to cap spending.

### Tips and limits

- Wikipedia search returns up to 10,000 results per query; results are ordered by relevance.
- Turning off full text makes runs several times faster when you only need summaries and metadata.
- Very long articles are cut at **Max text length** (100,000 characters by default; set 0 for no limit). `wordCount` always counts the whole article.
- Article URLs must match the chosen language edition. Run the Actor once per language.
- Page views count human traffic only (bots and spiders excluded) for the last 30 complete days.
- A `RUN_SUMMARY` record shows matches and saved articles per query, and any titles that were not found.

### FAQ

**Is the text clean?** Yes. It is the plain-text rendering from the TextExtracts API: no wiki markup, references or HTML. Section headings appear as plain lines.

**Do redirects work?** Yes. "Barack obama" returns the article "Barack Obama", with `requestedAs` showing what you typed.

**Can I get infobox data or tables?** Not in this version. It focuses on text, categories and metadata.

### Legal note

Wikipedia text is available under the Creative Commons Attribution-ShareAlike license. If you republish it, give attribution and follow the license terms. This Actor uses the official Wikimedia APIs with a descriptive User-Agent, as Wikimedia asks.

# Actor input Schema

## `searchQueries` (type: `array`):

Keywords to search on Wikipedia. Each query returns the best-matching articles.

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

Optional. Exact article titles (for example Alan Turing) or Wikipedia URLs. Redirects are followed.

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

Language edition code, for example en, de, fr, es, ja or zh.

## `maxArticlesPerQuery` (type: `integer`):

Up to 10,000 per search query.

## `includeFullText` (type: `boolean`):

Adds the whole article as plain text and its word count. Turn off for faster runs that only need the summary and metadata.

## `maxTextChars` (type: `integer`):

Long articles are cut to this many characters. 0 means no limit.

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

Adds the number of human page views over the last 30 days from the Wikimedia Pageviews API. One extra request per article.

## Actor input object example

```json
{
  "searchQueries": [
    "machine learning"
  ],
  "language": "en",
  "maxArticlesPerQuery": 10,
  "includeFullText": true,
  "maxTextChars": 100000,
  "includePageviews": false
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `resultsFull` (type: `string`):

No description

## `summary` (type: `string`):

No description

# 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 = {
    "searchQueries": [
        "machine learning"
    ],
    "maxArticlesPerQuery": 10
};

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

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

```

## MCP server setup

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