How to Extract Wikipedia Data and Articles at Scale
Wikipedia holds structured knowledge on nearly every topic imaginable, and all of it is publicly accessible. The problem is that the raw MediaWiki API is fiddly to work with: pagination, language edition URLs, redirect handling, and content parsing all require custom code. The NanoScrape Wikipedia Scraper handles all of that. Give it a list of article titles, Wikipedia URLs, or a search keyword and it returns structured JSON records with the full article text, summary, sections, categories, images, Wikidata ID, and 30-day page view counts. At $0.002 per article, a thousand articles costs $2.
In this tutorial
What you get
The NanoScrape Wikipedia Scraper uses the public Wikipedia and Wikimedia APIs and returns one structured JSON record per article. Each record contains:
- Full article text as plain text and cleaned HTML, split into sections with heading levels
- Summary and description: the one-line description and first-paragraph extract Wikipedia surfaces in search results
- Images: thumbnail, main image, and all image URLs embedded in the article
- Structured metadata: categories, external links, and reference citations
- Wikidata ID: the canonical Q-ID for every article, letting you link records to the Wikidata knowledge graph
- Geo coordinates: latitude and longitude for places, landmarks, and geographic entities
- 30-day page views: pulled from the Wikimedia pageviews API so you can gauge article traffic
- Disambiguation flag: identifies ambiguous pages before you ingest them
Because it uses Wikipedia's public APIs rather than browser scraping, there are no CSS selectors to maintain. The same input works across all 12 supported language editions.
Use cases
- AI and LLM training data: Wikipedia is a widely used encyclopedic corpus. Extract topic-specific article sets for fine-tuning or retrieval-augmented generation pipelines
- Knowledge graphs: link entities in your database to Wikidata Q-IDs and pull in coordinates, categories, and descriptions at scale
- Academic research: build multilingual topic corpora, track edits via last-modified timestamps, and cross-reference citations
- Content enrichment: add encyclopedic summaries, infobox facts, or related categories to product pages, blog posts, or travel content
- Fact-checking pipelines: verify claims against Wikipedia extracts and flag disambiguation pages automatically before downstream processing
- Travel and geo content: extract city, landmark, and attraction data with coordinates for maps, booking sites, or itinerary builders
- Biography datasets: scrape person articles for journalism or historical databases and link subjects to their Wikidata records
Prerequisites
- A free Apify account. New accounts get $5 of free credit, which covers 2,500 Wikipedia articles before you pay anything.
- A list of article titles, Wikipedia URLs, or a search keyword. Nothing else is required.
Step 1: Open the actor on Apify
Go to the Wikipedia Scraper actor page on Apify. Click Try for free to open the input form. First-time Apify visitors will create a free account before landing on the input screen.
Step 2: Configure your query
The actor accepts three input modes. Pick the one that fits your workflow:
- titles: an array of Wikipedia article titles (e.g., "Berlin", "Machine learning"). The scraper fetches each article directly without a search step.
- searchQuery: a keyword string. The actor runs a Wikipedia search and returns the top
maxSearchResultsarticles matching that query. - urls: an array of full Wikipedia URLs. The article title is extracted automatically from each URL.
A typical input for a research dataset looks like this:
{
"titles": [
"Artificial intelligence",
"Machine learning",
"Natural language processing",
"Large language model"
],
"language": "en",
"includeFullContent": true,
"includeImages": false,
"includeReferences": false
}To use search mode instead, swap titles for a searchQuery string and set maxSearchResults to the number of articles you want:
{
"searchQuery": "climate change",
"language": "en",
"maxSearchResults": 10,
"includeFullContent": true
}Step 3: Start the run
Click Start. Because the actor calls the official MediaWiki REST API rather than rendering pages in a browser, runs are fast.
Step 4: Export the results
Once the run finishes, open the Dataset tab. Each row is one Wikipedia article. Click Export to download as CSV, JSON, Excel, or Google Sheets. Here is a real output record from a run on the English article "Berlin" (long fields shortened, some list fields trimmed, content_html and the image/link lists omitted):
{
"title": "Berlin",
"url": "https://en.wikipedia.org/wiki/Berlin",
"language": "en",
"page_id": 3354,
"revision_id": 1380001131,
"extract": "Berlin is the capital and largest city of Germany. With 3.7 million inhabitants, ...",
"description": "Capital and largest city of Germany",
"content_full": "This article is about the capital city of Germany. ...",
"sections": [ { "title": "", "level": 0, "text": "Berlin is the capital and largest city of Germany. ..." } ],
"categories": ["Berlin", "Capital cities in Europe", "German state capitals"],
"coordinates": { "lat": 52.52, "lng": 13.405 },
"wikidata_id": "Q64",
"last_modified": "2026-10-13T04:54:07Z",
"word_count": 19965,
"view_count_30d": 163279,
"is_disambiguation": false,
"scraped_at": "2026-10-14T07:02:02Z"
}Input options
All input fields are optional except for at least one of titles, searchQuery, or urls.
titles(array of strings): Wikipedia article titles to fetch directly. Use the exact title as it appears in the Wikipedia URL, e.g., "Albert_Einstein" or "Machine learning".searchQuery(string): keyword for a Wikipedia full-text search. Returns the top N matching articles.urls(array of strings): full Wikipedia article URLs. The title is auto-extracted from each URL.language(enum, defaulten): which Wikipedia language edition to query. Supported:en,de,fr,es,it,pt,nl,pl,ru,ja,zh,ar.includeFullContent(boolean, defaulttrue): fetch the complete article body text and section breakdown. Set tofalseif you only need the summary and metadata.includeImages(boolean, defaulttrue): include thumbnail, main image, and all article image URLs. Set tofalseto skip images and reduce payload size.includeReferences(boolean, defaultfalse): include the full citation list. Useful for academic pipelines that need bibliography data.maxSearchResults(integer, default10): when usingsearchQuery, caps the number of articles returned.
Output field reference
title(string): normalized article titleurl(string): canonical Wikipedia URL for the articlelanguage(string): ISO language code of the Wikipedia edition, e.g.,enpage_id(integer): Wikipedia's internal numeric page IDrevision_id(integer): revision ID of the version that was scraped, useful for reproducibilityextract(string): first-paragraph plain-text extract, the same content Wikipedia shows in search snippetsdescription(string): Wikidata one-line description for the article subjectcontent_full(string): full article body as plain textcontent_html(string): the article HTML. This field is large (about 1.5 MB for the Berlin article), so skip it when you export if you only need textsections(array): per-section breakdown withtitle,level, andtextthumbnail_url(string): URL of the article thumbnail imagemain_image_url(string): URL of the main article imageimages(string[]): all image URLs found in the articlecategories(string[]): Wikipedia categories the article belongs toexternal_links(string[]): outbound links from the articlecoordinates(object):latandlngfor geographic articleswikidata_id(string): Wikidata Q-ID, e.g.,Q64for Berlinlast_modified(string): ISO 8601 timestamp of the last edit to the articleword_count(integer): number of words in the full article textview_count_30d(integer): page views over the last 30 days from the Wikimedia pageviews APIis_disambiguation(boolean): true if the article is a disambiguation pagescraped_at(string): ISO 8601 timestamp when this record was produced
What it costs
The actor uses pay-per-event pricing with two charge types:
- Actor run started (
enrichment-start): $0.001 per run, charged once regardless of how many articles you extract - Article scraped (
enrichment-result): $0.002 per article extracted
Example costs at those rates:
- 100 articles: ~$0.20
- 1,000 articles: ~$2.00
- 10,000 articles: ~$20.00
The actor calls public Wikipedia APIs, not a browser. Current rates are always on the actor page.
Automate with a schedule
To keep a dataset in sync with Wikipedia edits, schedule the actor to run daily or weekly. In the Apify console, go to Schedules, create a new schedule, and attach the Wikipedia Scraper with your saved input. The actor re-fetches each article and the last_modified field tells you which ones have changed.
For more complex pipelines, n8n can trigger a Wikipedia Scraper run, filter new or changed records, and push them to a Google Sheet, Airtable, Notion database, or vector store with no custom code.
FAQ
Do I need a Wikipedia API key?
No. The actor uses the public Wikipedia and Wikimedia APIs, which need no API key. You only need a free Apify account to run the scraper.
How many languages does it support?
12 language editions: English, German, French, Spanish, Italian, Portuguese, Dutch, Polish, Russian, Japanese, Chinese, and Arabic. Set the language input field to the appropriate ISO code, such as de for German or zh for Chinese.
How is this different from querying the Wikipedia API directly?
The actor handles the parts of the MediaWiki API that are annoying to work with: combining the summary, parse, and pageviews endpoints into a single call, resolving redirects, normalizing titles, handling disambiguation pages, and returning a clean unified JSON schema. You get a ready-to-use record without writing any glue code.
Can I extract data from multiple Wikipedia languages in one run?
Each run targets one language edition. To collect articles across languages, run the actor once per language with the same list of titles and then merge the results by Wikidata ID, which is consistent across all editions.
What is a Wikidata ID and why does it matter?
Every Wikipedia article is linked to a Wikidata entity identified by a Q-ID (e.g., Q64 for Berlin). The Q-ID is language-independent, so you can use it to join articles from different language editions, look up structured facts from the Wikidata knowledge graph, or link Wikipedia records to other datasets that use Wikidata as their entity layer.
Can I extract references or citations from articles?
Yes. Set includeReferences to true in the input. The actor will include the full citation list for each article. This field defaults to false because reference lists are large and most use cases do not need them.
Related resources
- Wikipedia Scraper actor page: Full specs, pricing details, and integration options.
- Wikipedia Scraper on Apify: Run the actor directly from the Apify console.
- How to scrape Reddit posts and comments: Another large public knowledge source for research and AI datasets: Reddit threads, comments, and community discussions.
- How to extract emails from websites in bulk: Enrich your contact data at scale: visit company websites and pull back emails, phone numbers, and social profiles.