Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get coordinates from a Wikipedia page through API?

I want to get the coordinates of a Wikipedia page through their API. I want to put the page title as 'titles' parameter. I have searched SO for a solution but seems they are scrapping the page then extracting. Is it possible through their API?

Kinkaku-ji

like image 291
Nasir Ahmed Avatar asked Oct 18 '16 02:10

Nasir Ahmed


People also ask

How do I get an API page on Wikipedia?

For example, the English Wikipedia is at https://en.wikipedia.org/w/api.php . For testing new accounts or test edits to pages, use the test wiki endpoint https://test.wikipedia.org/w/api.php . In the query string in the URL, add the action parameter. It tells the API which action to perform.

Does Wikipedia have APIS?

What is the Wikipedia API? The Wikipedia API (official documentation) is supported by the MediaWiki's API and provide access to Wikipedia and other MediaWiki data without interacting with the user interface.

How does Wikipedia get content?

Written collaboratively by largely anonymous volunteers, anyone with Internet access and in good standing can write and make changes to Wikipedia articles (except in limited cases where editing is restricted to prevent disruption or vandalism).


1 Answers

You need to use Wikipedia API. For your example with Kinkaku-ji the query will be:

https://en.wikipedia.org/w/api.php?action=query&prop=coordinates&titles=Kinkaku-ji

For more than one title use pipe to separate them: titles=Kinkaku-ji|Paris|...

like image 76
Termininja Avatar answered Nov 06 '22 23:11

Termininja