Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wikipedia API - get the links to searched results

Ok, this should be a childlishy easy task but I really can't find an answer for that. I want to make a Java application that would search wikipedia (with a given search query) and return a link to the most relevant article. Simple as that. I don't want to edit the content, parse through, export internal/external links. I just want it to return a link to the searched article. I have been browsing through Wikipedia API and found this action that should be helpful:

http://www.mediawiki.org/wiki/API%3AQuery

But it doesn't return a link. And I don't know how can I form a link using the Page ID. Maybe I need to ask another thing?

I feel stupid to ask this but really I can't get a straight answer from the tons of possibilities Wiki API offers.

like image 854
srd.pl Avatar asked Dec 02 '25 16:12

srd.pl


1 Answers

Query of the form http://en.wikipedia.org/w/api.php?action=query&title=<query> returns titles of the pages (among other things). http://en.wikipedia.org/wiki/<title> is your link to the page.

like image 108
Nishan Avatar answered Dec 04 '25 05:12

Nishan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!