Wikipedia API: How to get the City of a Place / Page / Article -


i want city of eiffel tower page using wikipedia api.

i used below code abstract intro, wikipageid, wikiurl, thumbnail/image, wikidataid & coordinates of wiki title eiffel_tower.

https://en.wikipedia.org/w/api.php?action=query&titles=eiffel_tower&prop=extracts|info|pageimages|coordinates|pageprops&exintro&explaintext&redirects&inprop=url 

how parent of places?

suppose want city / district / state / country of wikipedia places page.

for eiffel tower page wikipedia show location detail in paris [city] , france [country].

first find wikidata id of article (manually following "wikidata item" link in sidebar, programmatically e.g. using action=query&prop=pageprops api module), use wikidata query service , e.g.

select ?item ?itemlabel { wd:q243 wdt:p17|wdt:p131 ?item }


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -