I wish to extract the the first image within infobox - the table with the class name infobox that is on most Wikipedia pages, using Wikipedia/Mediawiki API
Here's what I've tried so far -
$.getJSON("http://en.wikipedia.org/w/api.php?action=mobileview&format=json&page=mumbai&redirect=no§ions=0&prop=text§ionprop=toclevel%7Clevel%7Cline%7Cnumber%7Cindex%7Cfromtitle%7Canchor&callback=?", function(json) {
var wikitext = json.mobileview.sections[0].text;
var img = $(wikitext).find('img:first').attr("src");
/*
//how can i make this work?
//selector for element with multiple classes - http://stackoverflow.com/questions/1041344/jquery-multiple-class-selector
var infoboximg = $(wikitext).find('table.infobox.geography.vcard img:first').attr("src");
console.log(infoboximg);
*/
$('#pic').append('<img src="http://' + img + '" />');
}
);
You can try the snippet here - http://jsbin.com/erudum/5/
How can I fix the code to grab the first image within the table having the name infobox?