# Wikipedia Scraper (`dami_studio/wikipedia-scraper`) Actor

Wikipedia scraper: search by keyword, or fetch exact article titles in any language edition. Search rows give the snippet, word count, size and last edit. Title rows give the intro or the full article as plain text, the lead image and the categories. $1.00 per 1,000 pages.

- **URL**: https://apify.com/dami_studio/wikipedia-scraper.md
- **Developed by:** [Dami's Studio](https://apify.com/dami_studio) (community)
- **Categories:** Integrations, AI, Other
- **Features:** Limited permissions
- **Stats:** 5 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.97 / 1,000 pages

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

**Search Wikipedia by keyword, or name exact article titles and get the article text back**, in any
language edition. A search gives you matching articles with a snippet, word count, size and last-edit
time. Named titles give you the intro or the whole article as plain text, the lead image and the
categories.

The two modes return different fields, and that catches people out: search rows have a snippet but
no article text, and title rows have the text but no search ranking. Pick the mode that matches what
you actually need.

| | |
|---|---|
| **Input** | A search query, or a list of exact article titles, in any language edition |
| **Output** | One row per article. Search: snippet, word count, size, last edit. Titles: intro or full text, lead image, categories |
| **Ceiling** | 5,000 pages per run |
| **Account needed** | None, and no API key |
| **Price** | $1.00 per 1,000 pages on the Free plan, a little less on paid plans. The free plan's $5 a month covers about 5,000 |

### 🔍 What Wikipedia Scraper does

In search mode it runs Wikipedia's own search and pages through the results until it reaches your
limit. Each row carries the page id, the title, a plain-text snippet with the highlighting stripped,
the article's word count and size, and when it was last edited.

In page-titles mode it fetches the articles you named. By default you get the intro paragraphs; tick
**Fetch full article text** and you get the whole article as plain text instead. Those rows also
carry the lead image and the visible category names.

Pick any language edition with `language`. `fr` reads the French Wikipedia and returns French
articles, in both modes.

### 📋 What data you get from each Wikipedia article

| What you get | Field |
|---|---|
| Wikipedia's numeric page id, the title and the link | `pageid`, `title`, `url` |
| Which mode produced the row | `mode` |
| Search rows: the matched text, length in words and bytes, last edit | `snippet`, `wordcount`, `size`, `timestamp` |
| Title rows: the intro or the whole article as plain text | `extract`, `fullText` |
| Title rows: the lead image | `thumbnail` |
| Title rows: the categories a reader sees | `categories` |

### ▶️ How to scrape Wikipedia

1. Open [Wikipedia Scraper](https://apify.com/dami_studio/wikipedia-scraper) and click
   **Try for free**.
2. For a search, type into **Search query** and leave **Page titles** alone.
3. For articles, clear **Search query**, then put exact titles into **Page titles**.
4. Set **Wikipedia language** and **Max items**, tick **Fetch full article text** if you want the
   whole article, then click **Start**.
5. Download the dataset as JSON, CSV or Excel, or read it from the Apify API.

### 💰 How much does it cost to scrape Wikipedia?

**$1.00 per 1,000 pages** on the Free plan. Paid plans pay a little less: $0.99 on Starter, $0.98 on Scale and $0.97 on Business. On the free plan, the $5 Apify
gives you each month covers about 5,000 pages.

You pay per page row delivered. Duplicate page ids are dropped before they reach you, diagnostic rows
are not charged, and if nothing is found, no rows are charged. Set a maximum cost on the run and it
stops when it gets there.

### 📥 What you give it

```json
{
  "searchQuery": "machine learning",
  "language": "en",
  "maxItems": 50
}
```

| Field | Default | What it is |
|---|---|---|
| `searchQuery` | none, the form starts with `machine learning` | Keywords to search for. Leave it empty to use `pageTitles` instead. |
| `pageTitles` | empty, the form starts with `Apify` and `Web scraping` | Exact article titles. Use this **or** a search query. |
| `fullText` | `false` | Whole article instead of the intro. **Only applies in page-titles mode**, and is ignored in search mode. |
| `language` | `en` | The language edition code: `en`, `fr`, `de`, `es`, `ja` and so on. |
| `maxItems` | `50` | How many pages to return, up to 5,000. In search mode it pages until it gets there. |
| `notionConnector` | none | Optional. Writes every page into your own Notion as well as the dataset. |
| `notionParentId` | none | Optional. The Notion data source to write into. |
| `proxyConfiguration` | off | Optional, and off by default because a normal run does not need it. |

**Both boxes start filled in, and a filled `searchQuery` wins.** If you want titles mode, clear the
search box first, or the sample titles are ignored.

**Titles have to be exact**, including capitalisation, exactly as they appear in the article URL.

### 📤 What you get back

A real search row from a run on 3 October 2026:

```json
{
  "ok": true,
  "mode": "search",
  "pageid": 233488,
  "title": "Machine learning",
  "url": "https://en.wikipedia.org/?curid=233488",
  "snippet": "Machine learning (ML) is a field of study in artificial intelligence concerned with the development and study of statistical algorithms that can learn",
  "wordcount": 16592,
  "size": 146371,
  "timestamp": "2026-09-28T05:58:05Z"
}
```

And a page-titles row, with the extract and the category list cut short:

```json
{
  "ok": true,
  "mode": "page",
  "fullText": false,
  "pageid": 11188,
  "title": "French Revolution",
  "url": "https://en.wikipedia.org/wiki/French_Revolution",
  "extract": "The French Revolution was a period of political and societal change in France that began with the Estates General of 1789 ...",
  "thumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/5/57/Anonymous_-_Prise_de_la_Bastille.jpg/500px-...",
  "categories": ["1789 conflicts", "Atlantic Revolutions", "Civil wars in France", "..."]
}
```

| Field | How to read it |
|---|---|
| `mode` | `search` or `page`. It tells you which set of fields to expect. |
| `pageid` | Wikipedia's own numeric id. Stable across renames, so use it as your key. |
| `snippet` | Search mode only. The matched text with the markup stripped. There is no `extract` on a search row. |
| `extract` | Page mode only. Plain text, intro or whole article depending on `fullText`. `null` when Wikipedia returned none. |
| `thumbnail` | Page mode only. The lead image, or `null` when the article has no image. |
| `categories` | Page mode only. The visible category names. Hidden maintenance categories are left out. |
| `wordcount`, `size` | Search mode only. Article length in words and bytes, useful for ranking what to read. |
| `timestamp` | Search mode only. When the article was last edited. |

### 🧾 Reading the output

Two kinds of row can land in your dataset.

| Row | How to spot it | Billed |
|---|---|---|
| A page | `ok: true` and a `pageid` | yes |
| A diagnostic | `ok: false` and an `errorCode` | no |

| Code | What it means |
|---|---|
| `BAD_INPUT` | Neither a search query nor any page titles were given. |
| `NOT_FOUND` | That exact title does not exist on that language edition. One row per missing title, in the order you listed them. |
| `NO_RESULTS` | The search ran and matched nothing, or no title in the list resolved. |
| `RATE_LIMITED` | Wikipedia asked for a slower pace. Re-run with a smaller `maxItems`. |
| `SERVER_ERROR` | Wikipedia answered with a server error. Usually passes on its own. |
| `NOT_SERVED` | This page was not served this run. Re-run it later. Runs before 13 October 2026 wrote `BLOCKED` here, and runs from 13 to 17 October wrote `NETWORK`. |
| `NETWORK` | Wikipedia could not be reached. A misspelled `language` code also lands here, because that edition does not exist. |
| `TIME_LIMIT` | The run got close to its time limit and stopped on its own. The pages delivered before that are complete and charged. Give the run more time, or ask for fewer pages, to get the rest. |

A run that ends on one of these rows still finishes as succeeded, including when the time limit
stopped it before any page came back: the `TIME_LIMIT` row and an amber status message say so.

**Rows arrive at the end, not as they are found.** Everything is fetched first and written
afterwards, so a large full-text run shows nothing in the dataset until it is done.

**The default table view has no `ok` column**, so a `NOT_FOUND` row looks like a blank line. Switch
to **All fields** or export as JSON.

### 💡 What people use it for

- Building a plain-text corpus on a subject, with `fullText` on and a list of titles.
- Grabbing the intro paragraph for a glossary or an internal wiki.
- Ranking what to read on a topic, using search mode and sorting on `wordcount`.
- Pulling the same article across language editions to compare how each one covers it.

From a topic to its full articles, in three steps:

1. Run a search with `searchQuery` set to your topic and copy the `title` column.
2. Start a second run with the search box empty, those titles in `pageTitles`, about 20 at a time,
   and `fullText` ticked.
3. Join the two on `pageid` to keep the search order next to the text.

### 🚧 What it does not do

- **Search rows have no article text.** If you need the text, take the titles from a search run and
  feed them into a second run in page-titles mode.
- **A long title list thins out.** Asked for many titles at once, Wikipedia stops returning extracts
  partway through the batch, so some rows come back with `extract: null` and no categories while
  still counting as pages. Keep a batch under about 20 titles and they come back complete.
- **Thousands of full articles take a long time.** Full text comes back one article at a time, so a
  list in the thousands can run close to the one-hour default timeout, and rows are only written at
  the end. Split long lists across runs.
- **No infoboxes, references, tables or wikitext.** Plain text only.
- **No revision history, no edit diffs, no talk pages.**
- **Titles are exact.** A near miss returns `NOT_FOUND` rather than the closest article.
- **No images beyond the lead thumbnail**, and nothing is downloaded.
- **The run finishes even when every request failed**, so read `ok` rather than the run status.
- It is not an official Wikipedia tool. Dami's Studio is independent and is not affiliated with or endorsed by Wikipedia or the Wikimedia Foundation, or by any other company named on this page.

### 🧭 Which reference scraper do you need?

| If you want | Use |
|---|---|
| Wikipedia search results or article text | This one |
| Wikidata Q-ids, aliases and claims, by name or by ID | [Wikidata Scraper](https://apify.com/dami_studio/wikidata-scraper) |
| Book metadata by keyword, title or ISBN | [Books Scraper](https://apify.com/dami_studio/books-scraper) |
| Goodreads ratings and rating counts from a book search | [Goodreads Books Scraper](https://apify.com/dami_studio/goodreads-books-scraper) |
| Books, audio, film and software held on archive.org | [Internet Archive Scraper](https://apify.com/dami_studio/internet-archive-scraper) |
| Papers with readable abstracts and citation counts | [OpenAlex Scraper](https://apify.com/dami_studio/openalex-scraper) |
| Wikipedia, arXiv and OpenAlex searches as tools for an AI agent | [Research MCP Server](https://apify.com/dami_studio/research-mcp-server) |

### ❓ Questions people ask

#### Do I need a Wikipedia account or an API key?

No. Wikipedia's API is open and nothing here needs an account.

#### Why is there no article text on a search row?

Because search mode never returns one. Take the titles and run them in page-titles mode.

#### Can I scrape a non-English Wikipedia?

Yes. Set `language` to the edition code and both modes follow it.

#### What happens if I fill in both boxes?

Search mode runs and the titles are ignored. Clear the search box to use titles.

#### Can I call it from code or connect it to an AI assistant?

The [API tab](https://apify.com/dami_studio/wikipedia-scraper/api/python) has code for Python, JavaScript and the CLI.
MCP clients like Claude and ChatGPT use
`https://mcp.apify.com/?tools=fetch-actor-details,dami_studio/wikipedia-scraper`; coding assistants can load [our
skill file](https://api.apify.com/v2/key-value-stores/BTBHU3DdiuoF4JOsK/records/apify-open-data-research-SKILL.md).
All three bill your Apify account at the same price.

#### Is scraping Wikipedia legal?

Wikipedia's content is published under a free licence and its API is open to the public. Check the
licence terms for how you attribute reuse. Apify's write-up on
[the legality of web scraping](https://blog.apify.com/is-web-scraping-legal/) is a good starting
point, and we are not lawyers.

### 🆘 If something breaks

Open the **Issues** tab on the actor page. Send the run ID, the query or titles you used, and the
language code. The `errorCode` on the diagnostic row usually names the problem on its own.

# Actor input Schema

## `searchQuery` (type: `string`):

Keywords to search Wikipedia for (e.g. "machine learning"). Returns matching pages with snippet, word count, and URL. Leave empty if you instead provide exact Page titles below.

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

Only applies in Page titles mode. When on, returns the whole article as plain text instead of just the intro paragraph(s).

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

Wikipedia language edition code, e.g. en, fr, de, es, ja. Picks the host {lang}.wikipedia.org.

## `pageTitles` (type: `array`):

Exact Wikipedia article titles to fetch full data for (plain-text extract, thumbnail, categories, URL). Batched 50 at a time. Use this OR a search query.

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

Maximum number of pages to return. In search mode the actor paginates until it reaches this. In page-titles mode it caps how many titles are fetched.

## `notionConnector` (type: `string`):

Optional. Write each page as a page into your Notion when the run finishes. Authorize a Notion connector once in Settings → API & Integrations → MCP connectors, then pick it here. Leave empty to skip (default), results are always saved to the dataset regardless.

## `notionParentId` (type: `string`):

Optional. The Notion data source ID of the database to write into (only used if a Notion connector is set). Leave empty to create the pages privately in your workspace instead.

## `proxyConfiguration` (type: `object`):

Optional, and not needed for a normal run.

## Actor input object example

```json
{
  "searchQuery": "machine learning",
  "fullText": false,
  "language": "en",
  "pageTitles": [
    "Apify",
    "Web scraping"
  ],
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Scraped rows are stored in the default dataset (one row per result). Blocked/empty/error runs return a single uncharged diagnostic row instead.

# 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 = {
    "searchQuery": "machine learning",
    "pageTitles": [
        "Apify",
        "Web scraping"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("dami_studio/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 = {
    "searchQuery": "machine learning",
    "pageTitles": [
        "Apify",
        "Web scraping",
    ],
}

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

```

## MCP server setup

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