I want to get the different sections with their pages from the Wikipedia:Featured articles.
By following this answer, I know I can get page titles of links as follows:
https://en.wikipedia.org/w/api.php?action=query&format=json&titles=Wikipedia:Featured articles&prop=revisions&rvprop=content
The result looks something like this:
{
"continue": {
"plcontinue": "5921878|0|Barack_Obama",
"continue": "||"
},
"query": {
"pages": {
"5921878": {
"pageid": 5921878,
"ns": 4,
"title": "Wikipedia:Featured articles",
"links": [
{
"ns": 0,
"title": "...And Justice for All (album)"
},
...
However, like that I don't get the section name under which each page/link is. For instance, "...And Justice for All (album)" lies under the Music section/header.
Is there a way to get i) the section each page belongs to or ii) the pages belonging to a section in the same or in a different query?
b) the music section that "And Justice for All" is under is denoted by the "
==Music== *" key word. I'm not familiar with Wikipedia's API, but there's got to be some way of tracing up the objects from "And Justice" to the key value, thats just how JSON works. – albert Aug 27 '16 at 16:31