Jana Müller
Jana Müller

Reputation: 9

Getting a Table of Content from Wikipedia (via API)

I want to do an android app and need to get the data from a table of content from wikipedia. I know that there is an API for wikipedia but couldn't find out how to get the data from a toc. On this site is an example of such a toc:

http://de.wikipedia.org/wiki/Liste_der_Tatort-Folgen

What is the best way to get the data? How does such a request look like?

Upvotes: -1

Views: 656

Answers (2)

RalfB
RalfB

Reputation: 11

What about this query? It returns the first 500 page links. The remaining links can be retrieved by updating the plcontinue parameter.

http://de.wikipedia.org/w/api.php?action=query&prop=links&format=xml&plnamespace=0&pllimit=1000&titles=Liste%20der%20Tatort-Folgen&plcontinue=1102295|0|Tatort:%201000%20Tode

Unfortunately, there is no way to get a list in chronological order. To achieve that you would have to extract the information directly from Html.

Upvotes: 0

svick
svick

Reputation: 244787

You don't say what data do you actually need, but to retrieve the TOC of a page, you can use action=parse with prop=sections. E.g.:

http://de.wikipedia.org/w/api.php?action=parse&page=Liste_der_Tatort-Folgen&prop=sections

Upvotes: 5

Related Questions