Steve Steve - 4 months ago 9
JSON Question

How to get table data from Wikipedia page?

Is there somebody who knows how to use the

Wikipedia API
to get
JSON
or
XML
data out from a table on a specific Wikipedia page?

Is there maybe a different way to do this?

For example from here
https://en.wikipedia.org/wiki/List_of_action_films_of_the_2010s

Answer

You can curl (or use any other method/tool) to retrieve and/or parse of a Wikipedia-URL via the public API. Here are two examples that should help you:

Retrieval of List_of_action_films_of_the_2010s:

Next, you would need to parse for and/or select the sub-elements relevant for your analysis. In this case I would assume: wikitable elements.

For reference and a detailed explanation, you can have a look at the general API page of MediaWiki and at the list of parameters on how to use the API to parse Wikipedia pages for certain data elements.