Question

I am trying to retrieve some Wikipedia informations using mediawiki api. I am trying to retrieve information of "Helmuth Johannes Ludwig von Moltke"

English link: http://en.wikipedia.org/wiki/Helmuth_von_Moltke_the_Younger
German link: http://de.wikipedia.org/wiki/Helmuth_Johannes_Ludwig_von_Moltke

In this two links the title (name of person) is different.

I am using mediawiki english api link to retrieve some info. So if I pass english name to API it is working fine. But not with german name link.

If I pass German name to german API link, it will retrieve data. But at that time I cannot perform any English string search to retrive data.

So is there any way to find the actual English name/link from a German link.

Please let me know if there is any other solution for this problem.

I would greatly appreciate any suggestions.

Was it helpful?

Solution

If you have the name of the German article, you can use the langlinks module of the German Wikipedia API to retrieve the language links of the article (including the English one):

https://de.wikipedia.org/w/api.php?action=query&titles=Helmuth_Johannes_Ludwig_von_Moltke&prop=langlinks&lllimit=max

If you only want the English link, use lllang=en:

https://de.wikipedia.org/w/api.php?action=query&titles=Helmuth_Johannes_Ludwig_von_Moltke&prop=langlinks&lllang=en

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top