I'm studying Wikipedia REST API but I'm not able to find the right option to get also URLs for a search query.
this is the URL of the request:
http://it.wikipedia.org/w/api.php?action=query&list=search&srsearch=calvino&format=xml&srprop=snippet
this request outputs only the Title and the Snippet but no URLs for articles. I've checked wikipedia API documentation for the list=search query but seems there is no option to get also URLs.
Best Regards, Fabio Buda
You can form the URL of the article easily by yourself from the title. For the Italian Wikipedia, it's http://it.wikipedia.org/wiki/
followed by the URL-encoded title of the article. It's as simple as that.
The actual URL of the article also replaces spaces with underscores, but you don't have to do that if you don't want to, the URL with spaces redirects to the one with underscores.
EDIT: You can get the URL, but it's not possible to get search-related information at the same time. To do that, use the list as a generator. For example:
http://it.wikipedia.org/w/api.php?action=query&generator=search&gsrsearch=calvino&format=xml&gsrprop=snippet&prop=info&inprop=url
But I think changing the format of page URLs is very unlikely: too many other people rely on that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With