I am looking to get the links on this WikiQuote page. I would like to see what subcategories exist under the ‘Fundamental’ category. They appear as links on the page, so it seemed natural to ask the API for the links. I only get back the “Category schemes” and “Main page” links, which exist in the introduction. What am I doing wrong/what have I misunderstood here?
CODE
function httpGetAsync(theUrl, callback){
xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
callback(xmlHttp.responseText);
}
}
xmlHttp.open("GET", theUrl, true); // true for asynchronous
xmlHttp.send('null');
}
function callback(json_response){
stuff = json_response;
console.log(JSON.stringify(JSON.parse(json_response), null, 2));
}
httpGetAsync('http://en.wikiquote.org/w/api.php?action=query&prop=links&titles=Category:Fundamental&origin=*&format=json', callback);
Output
{
"batchcomplete": "",
"query": {
"pages": {
"4480": {
"pageid": 4480,
"ns": 14,
"title": "Category:Fundamental",
"links": [
{
"ns": 4,
"title": "Wikiquote:Category schemes"
},
{
"ns": 14,
"title": "Category:Main page"
}
]
}
}
}
}