3

I know that to search for a page id of a wikipedia with known title, i can do:

https://en.wikipedia.org/w/api.php?action=query&titles=7_Studios

However, in this case, 7_Studios is a french wikipedia article, so the above link would not work. Instead I need to try

https://fr.wikipedia.org/w/api.php?action=query&titles=7_Studios

My question is, if I do not know what language the article is about but only the title itself, how can it make sure i can find it using the api?

Damjan Pavlica
  • 31,277
  • 10
  • 71
  • 76
Ziqi
  • 2,445
  • 5
  • 38
  • 65
  • 1
    You cannot. The different languages reside on different wiki installations. However, you might be able to query the interwiki link database at wikidata. – Bergi Mar 12 '14 at 12:40

1 Answers1

2

As Bergi mentioned, you can use Wikidata for this: it contains the database of interwiki links, so it's possible some article title won't be there, but most should.

To do this, you can use the wbgetentities module: you specify the title to search for and a list of wikis to search. For example:

https://www.wikidata.org/w/api.php?action=wbgetentities&titles=7_Studios&sites=enwiki|frwiki|nlwiki|dewiki

You can specify up to 50 wikis in one query. Currently, there are around 300 Wikipedias, so if you really need to query all of them, you may need up to 6 requests for each title.

svick
  • 236,525
  • 50
  • 385
  • 514