# Wikipedia Articles Extractor for RAG (`unbounded_seed/wikipedia-rag-extractor`) Actor

Turn Wikipedia into clean, LLM-ready data. Search or list article titles in any language and get plain text, summary, categories, Wikidata ID and paragraph chunks for RAG, embeddings and fine-tuning. CC BY-SA license and source URL on every row. Official MediaWiki API, no proxies.

- **URL**: https://apify.com/unbounded_seed/wikipedia-rag-extractor.md
- **Developed by:** [Unbounded Seed](https://apify.com/unbounded_seed) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

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 Articles Extractor for RAG

Search Wikipedia in any language and get clean plain text, summaries and ready-made chunks for RAG, LLM fine-tuning and knowledge bases.

**Pricing: $3.00 / 1,000 articles.** Pay only for the results you receive. No subscription.

### What does Wikipedia Articles Extractor for RAG do?

Turns Wikipedia into clean, LLM-ready data. Give it search terms or exact article titles, in any language edition, and it returns plain text with no markup, a short summary, categories, the Wikidata ID and paragraph-aligned chunks sized for your embedding model. Every row carries the CC BY-SA 4.0 license and source URL, so your dataset stays compliant.

**Use it to:** build RAG knowledge bases, fine-tune or evaluate LLMs, feed chatbots and knowledge graphs, or create multilingual training corpora. It uses the official MediaWiki API: no HTML scraping, no proxies, no blocks.

### Features

- Uses the official MediaWiki API with a descriptive User-Agent: no HTML scraping, no proxy.
- Search queries or exact titles, any language edition (en, es, de, fr...).
- Clean plain text without markup, paragraph-based chunks of configurable size, short description, categories and Wikidata ID.
- License and source URL on every row (CC BY-SA 4.0).

### Pricing

| Event | Price |
|---|---|
| Article (one dataset row) | $0.003 |
| Actor start | $0.00005 (Apify default) |

Set a maximum cost per run in Apify and the Actor stops automatically when it is reached.

### Input example

```json
{
  "searchQueries": [
    "web scraping"
  ],
  "language": "en",
  "resultsPerQuery": 3,
  "fullText": true,
  "chunkSize": 1500
}
```

### Output example

```json
{
  "title": "Web scraping",
  "pageId": 2696619,
  "language": "en",
  "url": "https://en.wikipedia.org/wiki/Web_scraping",
  "description": "Method of extracting data from websites",
  "wikidataId": "Q665452",
  "summary": "Web scraping, web harvesting, or web data extraction is data scraping used for extracting data from websites. Web scraping software may directly access the Worl...",
  "wordCount": 3137,
  "lastModified": "2026-11-08T21:20:06Z",
  "categories": [
    "Web scraping"
  ],
  "license": "CC BY-SA 4.0 - Wikipedia contributors",
  "attribution": "Source: https://en.wikipedia.org/wiki/Web_scraping",
  "text": "Web scraping, web harvesting, or web data extraction is data scraping used for extracting data from websites. Web scraping software may directly access the Worl...",
  "chunks": [
    {
      "index": 0,
      "text": "Web scraping, web harvesting, or web data extraction is data scraping used for extracting data from websites. Web scraping software may directly access the Worl..."
    },
    {
      "index": 1,
      "text": "History\nAfter the birth of the World Wide Web in 1989, the first web robot, World Wide Web Wanderer, was created in June 1993, which was intended only to measur..."
    }
  ]
}
```

Download the dataset as JSON, CSV, Excel, XML or HTML, or read it through the Apify API.

### Is it legal and safe to use?

Wikipedia text is licensed CC BY-SA 4.0: you must attribute and share-alike derived text; each row carries license and attribution fields. Respects Wikimedia API etiquette (serial requests, identifying User-Agent).

### FAQ

**How big are chunks?** Paragraph-aligned chunks of about `chunkSize` characters.

**Can I get tables or images?** Not in this version: plain text only.

### Support

Found a bug or need an extra field? Open an issue from the Actor page.

# Actor input Schema

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

Each query returns the top matching articles.

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

Specific article titles to fetch, e.g. Apache Kafka.

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

Language code: en, es, de, fr, ...

## `resultsPerQuery` (type: `integer`):

Articles per search query.

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

Return the whole article as clean plain text split into chunks (ideal for RAG). If off, only the intro summary.

## `chunkSize` (type: `integer`):

Approximate chunk length when splitting by paragraphs. 0 = no chunking.

## Actor input object example

```json
{
  "searchQueries": [
    "web scraping"
  ],
  "language": "en",
  "resultsPerQuery": 3,
  "fullText": true,
  "chunkSize": 1500
}
```

# 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 = {
    "searchQueries": [
        "web scraping"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("unbounded_seed/wikipedia-rag-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 = { "searchQueries": ["web scraping"] }

# Run the Actor and wait for it to finish
run = client.actor("unbounded_seed/wikipedia-rag-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 '{
  "searchQueries": [
    "web scraping"
  ]
}' |
apify call unbounded_seed/wikipedia-rag-extractor --silent --output-dataset

```

## MCP server setup

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