# Wikipedia Article Extractor: Markdown, Infobox JSON (`itayozer9/wikipedia-article-extractor`) Actor

Wikipedia articles in any of 300+ languages by title, URL or search: clean Markdown or text, sections, infobox as JSON, categories, references, links to other languages and CC BY-SA attribution. Official Wikimedia APIs.

- **URL**: https://apify.com/itayozer9/wikipedia-article-extractor.md
- **Developed by:** [Itay Ozer](https://apify.com/itayozer9) (community)
- **Categories:** AI, Agents, Education
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 1,000 article extracteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 Extractor: Markdown, Infobox JSON

Give it Wikipedia article titles, URLs or a search query, in any of the 300+ language editions, and get each article back as clean Markdown or plain text, split into sections, with the infobox as JSON, categories, footnotes, links to the same article in other languages, and a ready-made CC BY-SA attribution line. Built for AI agents, RAG pipelines, translators and researchers who work beyond English.

Everything comes from the official Wikimedia APIs (the Action API for metadata and search, the REST API for the article HTML), called the way Wikimedia's API rules ask: an identifying User-Agent, gzip, a few requests at a time, and a pause whenever Wikipedia says to slow down. No browser, no proxies, no blocked pages.

### What you get

For every article:

- `title`, `url`, `language`, `pageId`, `revisionId`, `lastEdited`, and `redirectedFrom` when you used an old or alternate title
- `description` (the short description), `wikidataId` (Q number), `isDisambiguation`, `imageUrl` (main image)
- `summary`: the lead section as plain text
- `content`: the whole article as Markdown (headings, lists, bold, tables) or plain text, without citation marks, navigation boxes, images or edit links
- `wordCount`: counted per word even for Chinese, Japanese and Thai
- `sections`: one entry per heading with `level` (0 = lead), `title`, `anchor` and `content`, ready for chunking
- `infobox`: the fact box as `{ "label": "value" }`; sub-rows carry their group, for example `"Population (2024): Metro"`
- `categories`: visible categories, in the article's language
- `languageLinks`: the same article in every other language edition (`language`, `title`, `url`)
- `references` (optional): each footnote's text and its first source URL
- `attribution`: license, license URL, link to the contributor history and a one-line credit you can paste under the text

### Input

| Field | Default | Notes |
|---|---|---|
| `articles` | | Titles in the chosen language, or Wikipedia URLs in any language (desktop, mobile, `?title=` and `zh-hans` style links) |
| `language` | `en` | Edition code for plain titles and the search: `de`, `fr`, `ja`, `zh`, `he`, `ar`, `pt`, `ko`... |
| `searchQuery` | | Optional full-text search in that edition; its top results are extracted too |
| `searchLimit` | `10` | 1 to 500 search results |
| `outputFormat` | `markdown` | `markdown` or `text` |
| `includeSections` | `true` | Section list with text |
| `includeInfobox` | `true` | Infobox as JSON |
| `includeLanguageLinks` | `true` | Other language versions |
| `includeReferences` | `false` | Footnotes with source URLs |
| `keepLinks` | `false` | Keep `[text](url)` links in Markdown (off = shorter text for LLMs) |
| `maxArticles` | `100` | 1 to 2000 per run. You pay only for articles returned |

```json
{
    "articles": ["Ada Lovelace", "https://ja.wikipedia.org/wiki/東京", "https://he.wikipedia.org/wiki/תל_אביב-יפו"],
    "language": "en",
    "outputFormat": "markdown",
    "includeReferences": false
}
```

### Output example

Shortened:

```json
{
    "status": "ok",
    "input": "Tel Aviv",
    "language": "en",
    "title": "Tel Aviv",
    "pageId": 31453,
    "url": "https://en.wikipedia.org/wiki/Tel_Aviv",
    "description": "City in Central Israel",
    "wikidataId": "Q33935",
    "isDisambiguation": false,
    "summary": "Tel Aviv, officially Tel Aviv-Yafo, and also known as Tel Aviv-Jaffa, is the most populous city in the Gush Dan metropolitan area of Israel...",
    "content": "# Tel Aviv\n\n**Tel Aviv**, officially **Tel Aviv-Yafo**...\n\n## Etymology and origins\n\n...",
    "format": "markdown",
    "wordCount": 12386,
    "sections": [
        { "level": 0, "title": null, "anchor": null, "content": "**Tel Aviv**, officially..." },
        { "level": 2, "title": "Etymology and origins", "anchor": "Etymology_and_origins", "content": "..." }
    ],
    "infobox": {
        "Country": "Israel",
        "Government: Mayor": "Ron Huldai",
        "Area: City": "52 km2 (20 sq mi)",
        "Population (2024): City": "494,900",
        "Time zone": "UTC+2 (IST)"
    },
    "categories": ["Tel Aviv", "Cities in Tel Aviv District", "..."],
    "languageLinks": [
        { "language": "he", "title": "תל אביב-יפו", "url": "https://he.wikipedia.org/wiki/%D7%AA%D7%9C_%D7%90%D7%91%D7%99%D7%91-%D7%99%D7%A4%D7%95" }
    ],
    "attribution": {
        "source": "Wikipedia (en)",
        "license": "CC BY-SA 4.0",
        "licenseUrl": "https://creativecommons.org/licenses/by-sa/4.0/",
        "authorsUrl": "https://en.wikipedia.org/w/index.php?title=Tel_Aviv&action=history",
        "text": "Text from the Wikipedia article \"Tel Aviv\" (https://en.wikipedia.org/wiki/Tel_Aviv) by Wikipedia contributors (...), licensed under CC BY-SA 4.0 (...). Converted to Markdown; images, navigation boxes and citation marks removed."
    },
    "error": null,
    "scrapedAt": "2026-10-31T19:00:00.000Z"
}
```

A title that does not exist, a bad URL or an unknown language code gives a free row with `status` (`not-found`, `invalid-input`, `invalid-language`, `unknown-language`, `no-results` or `error`) and a plain-English `error`, so a batch never fails because of one bad title.

### Pricing

Pay per article returned:

| Event | Price | When |
|---|---|---|
| Actor start | $0.00005 | Once per run |
| Article | $0.0007 | Every article in your dataset |

Example: 1,000 articles cost $0.70. Missing titles, bad input and Wikipedia errors are never charged, and a title that appears twice is returned and billed once.

The actor reads your run's maximum charge before it fetches anything and stops at what that covers, so a run never goes over the limit you set.

### Using the text: CC BY-SA attribution

Wikipedia text is free to reuse, also commercially, under the Creative Commons Attribution-ShareAlike 4.0 license. Wikimedia's Terms of Use ask reusers to credit the authors with a link to the article (its history lists every contributor), name the license, say that the text was changed, and share changed text under the same license. Every row carries an `attribution` object for that: paste `attribution.text` next to the text wherever you publish it. Images are not included; each image has its own license on Wikimedia Commons.

This actor is not made or endorsed by the Wikimedia Foundation. Wikipedia is a trademark of the Wikimedia Foundation.

### Limits

- Speed: requests are paced to stay inside Wikimedia's limits for unauthenticated tools (about 170 requests a minute, at most 3 at a time). In our tests at the default 1 GB memory, 30 shorter Spanish articles took 13 seconds and 49 long English articles with references took under 2 minutes. Less memory works but runs slower; more is not allowed because it would not help.
- Up to 2,000 articles per run. For millions of pages, Wikimedia asks for its database dumps or Wikimedia Enterprise instead.
- Text is the current version of each article at the time of the run.
- Only the article namespace: talk, user, category and file pages come back as `not-found`.
- Infobox parsing works on the standard infobox tables used by most editions (English, French, Spanish, Hebrew, Japanese, Russian and others). Some editions, for example German, use few infoboxes, so `infobox` is often `null` there.
- Tables become Markdown tables; merged cells (rowspan, colspan) are not expanded.
- Math is kept as LaTeX between `$` signs.

### FAQ

**Which languages work?**
All Wikipedia editions. Use the code from the edition's address: `en` for en.wikipedia.org, `pt` for Portuguese, `zh` for Chinese, `simple` for Simple English. Or paste the full URL and the language is taken from it.

**Can I get the same article in other languages?**
Yes. `languageLinks` lists the title and URL of the article in every edition that has it. Feed those URLs back in as `articles` to extract them.

**Why is my article marked `not-found`?**
The title does not exist in that edition. Titles are case sensitive after the first letter, and each edition uses its own titles (the German article about Germany is "Deutschland"). To be sure, paste the article URL, or take the title from `languageLinks` of the English article.

**Do I get disambiguation pages?**
Yes, they are returned like other articles, with `isDisambiguation: true`, and they count as an article.

**Can I call it from an AI agent or on a schedule?**
Yes. It runs with limited permissions (no access to your other Apify data) and works from the API, schedules and MCP clients.

**Is there personal data in the results?**
The results are encyclopedia articles as published on Wikipedia. Articles about living people are public encyclopedia entries; no user accounts, editor names or contact details are collected.

**Something looks wrong in the output. What do I do?**
Open an issue on the Issues tab with your run link and the article title. Issues are answered within a few days.

# Actor input Schema

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

Article titles (in the language below) or full Wikipedia URLs in any language, for example https://ja.wikipedia.org/wiki/東京. A URL's language wins over the language field. Redirects are followed.

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

Wikipedia language code for plain titles and the search: en, de, fr, es, ja, zh, ru, pt, it, ar, he, ko, pl, nl, tr, uk... (any of the 300+ editions, list: https://meta.wikimedia.org/wiki/List_of_Wikipedias).

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

Full-text search in the chosen language edition. The top results are extracted after the articles above.

## `searchLimit` (type: `integer`):

How many search results to extract (1 to 500).

## `outputFormat` (type: `string`):

Markdown keeps headings, lists, bold and tables. Plain text is one line per paragraph.

## `includeSections` (type: `boolean`):

Add the article split into sections (heading, level, anchor, text). Handy for RAG chunking.

## `includeInfobox` (type: `boolean`):

Add the infobox (the fact box at the top right) as label: value pairs.

## `includeLanguageLinks` (type: `boolean`):

Add the title and URL of the same article in every other language edition.

## `includeReferences` (type: `boolean`):

Add the footnotes and citations (text plus the first source URL of each).

## `keepLinks` (type: `boolean`):

Keep links as [text](url). Off gives shorter text for LLMs.

## `maxArticles` (type: `integer`):

Most articles to return in this run (1 to 2000). You pay only for articles returned; missing titles are free.

## Actor input object example

```json
{
  "articles": [
    "Ada Lovelace",
    "https://de.wikipedia.org/wiki/Berlin"
  ],
  "language": "en",
  "searchLimit": 10,
  "outputFormat": "markdown",
  "includeSections": true,
  "includeInfobox": true,
  "includeLanguageLinks": true,
  "includeReferences": false,
  "keepLinks": false,
  "maxArticles": 100
}
```

# Actor output Schema

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

One item per article, plus a free item per title that could not be returned.

# 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 = {
    "articles": [
        "Ada Lovelace",
        "https://de.wikipedia.org/wiki/Berlin"
    ],
    "language": "en"
};

// Run the Actor and wait for it to finish
const run = await client.actor("itayozer9/wikipedia-article-extractor").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 = {
    "articles": [
        "Ada Lovelace",
        "https://de.wikipedia.org/wiki/Berlin",
    ],
    "language": "en",
}

# Run the Actor and wait for it to finish
run = client.actor("itayozer9/wikipedia-article-extractor").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 '{
  "articles": [
    "Ada Lovelace",
    "https://de.wikipedia.org/wiki/Berlin"
  ],
  "language": "en"
}' |
apify call itayozer9/wikipedia-article-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,itayozer9/wikipedia-article-extractor"
        }
    }
}
```

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/HrbSfaux1jk7KTQI1/builds/ONDi5ZcHvuqhotsWK/openapi.json
