5

I'm trying to extract English Wikipedia articles related to a list of Arabic articles, let's say I have this article

https://ar.wikipedia.org/wiki/%D8%A7%D9%84%D9%82%D8%AF%D8%B3

and I need to extract the English version of it

https://en.wikipedia.org/wiki/Jerusalem

The problem is that I don't have the list of English names corresponding to the Arabic names list to use it with the API's, I think about extracting the language links and do some processing on the result to extract the English names but don't know if there is any easier way using the Mediawiki API's that you can suggest?

Afnan Ahmad
  • 163
  • 5

1 Answers1

3

The easiest way to do this is through wikidata. There's a wikidata item for all the wikipedia pages, and wikidata has links to all the wiki pages about the particular term. So, here's an example query that would give you the English name from Arabic name:

https://www.wikidata.org/w/api.php?action=wbgetentities&sites=arwiki&titles=%D8%A7%D9%84%D9%82%D8%AF%D8%B3&languages=en

Petr
  • 5,999
  • 2
  • 19
  • 25
  • 4
    Or you can just use the language links which is a more straightforward way to do the same (and in rare cases might yield results even where Wikidata would not): https://ar.wikipedia.org/w/api.php?action=query&prop=langlinks&titles=%D8%A7%D9%84%D9%82%D8%AF%D8%B3&lllang=en&formatversion=2 – Tgr Nov 22 '16 at 07:14
  • @Tgr you gave me the actual answer, great! – Jason Angel Jan 22 '21 at 22:16