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

Wikipedia articles in any language by title, search, category or URL via the public MediaWiki API: page ID, URL, description, intro, categories, coordinates, image, last edit, Wikidata ID. Optional full text, sections, infobox, links, pageviews.

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

## Pricing

from $0.56 / 1,000 articles

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

Get Wikipedia articles as clean JSON, CSV or Excel, in any language edition. Look them up by exact title, search term, category or URL. Each article comes with its page ID, URL, language, short description, intro text, categories, coordinates (for places), lead image, last edit time and Wikidata ID. Switch on details to add the full plain text, the section list, the infobox as key/value pairs, the links count and the image files, and optionally the last 30 days of pageviews. The data comes from Wikipedia's public MediaWiki and pageviews APIs: no key, no login.

### What you can do with it

- Build a knowledge dataset for AI, RAG or research from a list of titles, a search, or a whole category.
- Pull infobox facts (born, founded, population, headquarters) for companies, people and places.
- Track article popularity with 30-day pageviews, or find recently edited articles.
- Link records to Wikidata through the `wikidataId` field.
- Run the same list of titles in several languages at once (`languages`: en, de, fr, ja ...).
- Paste article, category or search URLs from any language edition.

### Input example

```json
{
  "titles": ["Python (programming language)", "Web scraping"],
  "searchTerms": ["machine learning"],
  "language": "en",
  "includeDetails": true,
  "includePageviews": true,
  "maxItems": 50
}
```

`titles`, `searchTerms`, `categories`, `languages` and `startUrls` accept plain strings or lists. Categories list the articles directly inside the category. Titles that do not exist are skipped and listed in the run summary.

### Output example

```json
{
  "pageId": 22989,
  "url": "https://en.wikipedia.org/wiki/Paris",
  "title": "Paris",
  "language": "en",
  "description": "Capital and largest city of France",
  "isDisambiguation": false,
  "extract": "Paris is the capital and largest city of France, with an estimated city population of 2.04 million ...",
  "wikidataId": "Q90",
  "lastEdited": "2026-11-12T23:00:18Z",
  "lengthBytes": 231208,
  "coordinates": {"lat": 48.8567, "lon": 2.3522},
  "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/4/4b/La_Tour_Eiffel_vue_de_la_Tour_Saint-Jacques%2C_Paris_ao%C3%BBt_2014_%282%29.jpg",
  "categories": ["Capital cities in Europe", "Catholic pilgrimage sites", "Cities in France"],
  "fullText": null,
  "sections": null,
  "infobox": null,
  "linksCount": null,
  "images": null,
  "pageviews30d": null
}
```

With "Include full text and details": `fullText` (plain text up to the References-type sections, cut at `maxTextChars` when set), `sections` (`{level, title, number}`), `infobox` (label to value text, "when the article has one"), `linksCount` (links to other articles) and `images` (file URLs, up to the page's image files). With "Include pageviews": `pageviews30d` (views by users in the last 30 days).

### Pricing

| Event | Price |
| --- | --- |
| Article (one row) | $0.0007 |
| Details (only with "Include full text and details", per article) | $0.0010 |
| Actor start | $0.00005 |

Pageviews have no extra charge. Paid plans get volume discounts. Platform usage is included: you pay only for the events above.

### Proxy note

Wikimedia rate-limits clients per IP and asks for a descriptive User-Agent, which the Actor sends (Apify-Wikipedia-Actor/1.0). The Actor keeps to two requests at a time and retries 429 answers on a fresh IP; Apify Proxy is on by default. Articles come 20 per request, details cost one request each.

### FAQ

**How do I scrape Wikipedia articles by title?** Put the titles in `titles` (redirects are followed) and choose the `language`.

**Can I get all articles of a category?** Yes: add the category name to `categories`. Only articles directly in that category are listed; add subcategories yourself.

**Does it return the infobox?** Yes, with "Include full text and details": the first infobox of the article as key/value text. Articles without an infobox return null.

**Does it work in other languages?** Yes. Set `language` or `languages`, or paste URLs from any language edition.

**Is the data public and licensed?** Wikipedia text is public and licensed CC BY-SA, so keep attribution when you reuse it. The Actor collects no private data.

# Actor input Schema

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

Exact article titles, for example Python (programming language). Redirects are followed. Plain strings are fine.

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

Wikipedia search queries; each returns the top matching articles (up to maxItems, 10,000 per search).

## `categories` (type: `array`):

Category names, with or without the Category: prefix. Lists the articles directly in the category (not subcategories).

## `startUrls` (type: `array`):

Article, category or search URLs from any language edition (en.wikipedia.org/wiki/..., de.wikipedia.org/wiki/Kategorie:...). The language comes from the URL.

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

Wikipedia language code for titles, search terms and categories: en, de, fr, es, ja, ru, pt, it, zh, ar and more.

## `languages` (type: `array`):

Several language codes to run the same titles, searches and categories on each. Overrides 'Language' when set.

## `includeDetails` (type: `boolean`):

Add the full plain text, section list, infobox key/values, links count and image files of each article (one extra API call per article, charged as a separate 'Details' event).

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

Cut the full text after this many characters. Empty keeps everything.

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

Add the article's views over the last 30 days from the public Wikimedia pageviews API (one extra call per article, no extra charge).

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

Stop after this many articles. Keeps cost predictable.

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

Wikimedia limits request rates per IP. Apify Proxy (on by default) spreads the requests; the Actor also paces itself and retries on 429.

## Actor input object example

```json
{
  "titles": [
    "Web scraping",
    "Data mining",
    "Web crawler"
  ],
  "language": "en",
  "maxItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (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 = {
    "titles": [
        "Web scraping",
        "Data mining",
        "Web crawler"
    ],
    "language": "en",
    "maxItems": 20,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("tortuga/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 = {
    "titles": [
        "Web scraping",
        "Data mining",
        "Web crawler",
    ],
    "language": "en",
    "maxItems": 20,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("tortuga/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 '{
  "titles": [
    "Web scraping",
    "Data mining",
    "Web crawler"
  ],
  "language": "en",
  "maxItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call tortuga/wikipedia-scraper --silent --output-dataset

```

## MCP server setup

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