Reputation: 2084
I want to extract the list of disciplines from this wiki page https://en.wikipedia.org/wiki/Outline_of_academic_disciplines, and I want to know how can I do it using the Wikipedia API.
I tried as following : https://en.wikipedia.org/w/api.php?action=parse&page=List_of_action_films_of_the_2010s&contentmodel=wikitext&prop=wikitext&format=json
but this only retrieve the first section of the article, and I want to retrieve the section of Contents, so the result would look something like this :
{
Arts : {
"Performing Arts" : [all its sub-child],
"Visual arts" : [all its sub-child]
}
Geography: {....}
}
Is this possible using the Wikipedia API ?
Upvotes: 0
Views: 999
Reputation: 28160
action=parse&format=json&page=Outline_of_academic_disciplines&prop=sections:
"sections": [
{
"toclevel": 1,
"level": "2",
"line": "Arts",
"number": "1",
"index": "1",
"fromtitle": "Outline_of_academic_disciplines",
"byteoffset": 1241,
"anchor": "Arts"
},
{
"toclevel": 2,
"level": "3",
"line": "Performing arts",
"number": "1.1",
"index": "2",
"fromtitle": "Outline_of_academic_disciplines",
"byteoffset": 1279,
"anchor": "Performing_arts"
},
...
Upvotes: 2