Wikipedia scraper and API skills

Site: wikipedia.org

Wikipedia's MediaWiki APIs are open and well documented, and these skills use them — while routing around the parts that have been decommissioned and the current-events pages that were never in the API at all.

Working with Wikipedia

  • The mobile-sections REST endpoint is decommissioned and returns 403; section trees are read from the endpoints that still exist.
  • Current-events portal subpages use a non-zero-padded day of month, which is the single most common reason a date-built URL 404s.

2 Wikipedia skills

Wikipedia scraping questions

Does Wikipedia have an API?
Yes — the MediaWiki Action and REST APIs are open and need no key. Some endpoints have been decommissioned, and the current-events portal is not exposed as structured data.
Is scraping Wikipedia legal?
Reading data that Wikipedia publishes publicly is generally treated as lawful in the US — hiQ v. LinkedIn found that scraping a public site does not by itself violate the Computer Fraud and Abuse Act. That is not the whole question: Wikipedia's terms of service, its robots.txt, the rate at which you request pages, and any personal or copyrighted data you collect all carry their own obligations, and the rules differ outside the US. These skills read public pages at human-scale rates and never bypass a login. Treat this as background, not legal advice.
What data can I extract from Wikipedia?
Page ID, revision, title, canonical URL and lead extract; plus current-events headlines bucketed by category with their source dates.

Related hubs