I have a function that gets the first section of a random Wikipedia article, but I don't know how to get the actual URL of that article. I've looked around in the WikiMedia API and couldn't find it.
getRandomArticle : function() {
return $.getJSON("http://en.wikipedia.org/w/api.php?action=query&generator=random&grnnamespace=0&prop=extracts&explaintext&exintro=&format=json&callback=?", function (data) {});
}
Any ideas?
It's not as easy as you might think. The API returns pages with internal ID's, and you have to use the API again to get information on the particular page, such as the URL.
FIDDLE