Wikipedia Table Extractor avatar

Wikipedia Table Extractor

Pricing

from $0.50 / 1,000 results

Go to Apify Store
Wikipedia Table Extractor

Wikipedia Table Extractor

Extract structured data from Wikipedia tables as clean JSON. Supports all languages, multiple tables and header detection. Ideal for AI training data and research.

Pricing

from $0.50 / 1,000 results

Rating

0.0

(0)

Developer

Muhammad Naufal

Muhammad Naufal

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

0

Monthly active users

19 hours ago

Last modified

Share

πŸ“— Wikipedia Data Scraper

Extract tables from any Wikipedia page as clean JSON. Supports wikitable, infobox, sortable, and various Wikipedia table layouts.

Features

  • Table extraction β€” wikitable, infobox, sortable, toccolours, plain tables
  • colspan/rowspan β€” merged cells properly replicated (incl. multi-column rowspans)
  • 2-row thead headers β€” group + subheader rows merged (subheader (group)), with correct handling for both group-on-bottom (labels under columns) and group-on-top (coarse group row above the real column names) layouts
  • Row-header tables β€” tables without a header row whose data rows lead with <th> (e.g. Country | US | Canada) get the leading <th> as the column name plus positional col1..colN
  • Clean cell text β€” footnote/citation markers ([1]), edit links, "citation needed" tags, and <abbr> stripped from values (abbr titles preserved: <abbr title="United States">US</abbr> β†’ United States); <br> word-splits in headers/cells keep their space (Total<br>in km2 β†’ Total in km2)
  • Sortable tables β€” human-readable display text kept; raw sort key exposed as {key}_sortValue (dict) or parallel _sortValues array (array format)
  • Image-only cells β€” X/check icon cells fall back to data-sort-value or img[alt] text
  • Multi-language β€” relative links resolve against the page's own origin (fr.wikipedia.org stays on fr.wikipedia.org); bare article titles / mobile URLs (m.wikipedia.org) auto-normalized to en.wikipedia.org
  • Page metadata β€” categories, short description, last-modified, infobox key-values, and accurate page stats (edit count, page length, creator, latest editor, watchers) pulled from Wikipedia's page-info page
  • Identity metadata β€” pageId, revisionId, wikidataId, canonicalTitle, namespaceName, pageName, protectionLevel, lastEditor, language
  • Page classification β€” isRedirect (+ redirectedFrom), isDisambiguation, isStub flags
  • Section context β€” nearest h2/h3 heading for each table
  • Link extraction β€” href links from anchor elements within cells (footnote/anchor links filtered out)
  • Multiple tables β€” extract one or all tables on a page
  • Dict or array β€” column-header keys or positional col0/col1 format

Sample output

{
"page": "https://en.wikipedia.org/wiki/List_of_largest_companies_by_revenue",
"title": "List of largest companies by revenue - Wikipedia",
"tablesFound": 3,
"totalRows": 5,
"metadata": {
"categories": ["Lists of companies by revenue", "Economic lists"],
"description": "Wikimedia list article",
"pageId": "27453603",
"wikidataId": "Q918765",
"sitelinksCount": 38,
"talkPageUrl": "https://en.wikipedia.org/wiki/Talk:List_of_largest_companies_by_revenue",
"editCount": "15699",
"contributorsCount": "412",
"lastEdited": "2026-07-28T09:14:22Z"
},
"tables": [
{
"tableIndex": 0,
"tableType": "data",
"section": "2024 list",
"headers": ["rank", "company", "country"],
"count": 5,
"rows": [
{"_rowNumber": 1, "rank": "1", "company": "Walmart", "country": "United States", "url": "https://en.wikipedia.org/wiki/List_of_largest_companies_by_revenue"},
{"_rowNumber": 2, "rank": "2", "company": "Saudi Aramco", "country": "Saudi Arabia", "url": "https://en.wikipedia.org/wiki/List_of_largest_companies_by_revenue"}
]
}
]
}

Input

FieldTypeDefaultDescription
pageUrlstringList of largest companiesFull Wikipedia URL (bare article titles and m.wikipedia.org links also accepted)
tableIndexinteger0Which table (0 = first)
maxResultsinteger20Max rows per table
outputFormatstringdictdict (headers as keys) or array
includeHeaderbooleanfalseInclude header row?
allTablesbooleanfalseExtract all tables?
extractMetadatabooleanfalsePage categories, description, infobox, last-modified, page stats
includeLinksbooleanfalseExtract href links from anchor elements
sectionContextbooleanfalseInclude nearest h2/h3 heading per table
captionstringβ€”Table <caption> text auto-extracted

New metadata fields (when extractMetadata=true):

  • lastEdited β€” ISO date of the latest edit (from Wikipedia's page-info page)
  • pageLength β€” page content length in bytes (accurate, from page-info)
  • editCount β€” total number of edits to the page (accurate, from page-info)
  • pageId β€” Wikipedia article ID
  • wikiDataId β€” Wikidata entity ID (Q...)
  • revisionId β€” current revision number
  • canonicalTitle β€” page title (wgTitle)
  • namespaceName β€” namespace name (e.g. "Talk", "Template")
  • pageName β€” full page path with underscores (wgPageName)
  • protectionLevel β€” edit protection level(s), comma-joined
  • lastEditor β€” username of the last editor
  • language β€” page language code
  • pageCreator β€” username of the page creator
  • createdOn β€” date the page was created (ISO when parseable)
  • watchersCount β€” number of page watchers
  • templateCount β€” number of transcluded templates
  • contributorsCount β€” number of distinct page contributors (from page-info)
  • sitelinksCount β€” number of Wikidata sitelinks for the article
  • talkPageUrl β€” URL of the article's talk page
  • isOrphan β€” set to true when the article has no incoming links from other articles
  • incomingLinksCount β€” number of incoming article links (article namespace only, from the backlinks API; capped at ~1500)
  • externalLinksCount β€” number of distinct external links in the article content
  • referencesCount β€” number of reference-list items in the article
  • sections β€” list of the article's section headings (h2)
  • isRedirect / redirectedFrom β€” set when the requested URL was a redirect
  • isDisambiguation β€” set on disambiguation pages
  • isStub β€” set on stub pages

Pricing

$0.001 per result ($0.50 per 1k rows).