Get a program list of all Wikipedia languages

I need to get a list of all existing languages ​​for a specific wiki project. For example, all Wikivoyage or all Wikipedia languages, as on landing pages.

I prefer to do this through the MediaWiki API , if possible.

Thank you for your time.

+7
wikipedia wikipedia-api mediawiki-api wikimedia
source share
3 answers

Approach 3: Using the Wikimedia API on the Wikimedia Farm and Extending: Sitematrix

https://commons.wikimedia.org/w/api.php?action=sitematrix&smtype=language

While this will return all the wikis that the matrix knows about, it is easily filtered on the client side code [currently one of: wiki (Wikipedia), wiktionary , wikibooks , wikinews , wikiquote , wikisource , wikiversity , wikivoyage ] and its state closed . One request with a small part of the answer, but since it is easily cached and compressed well, not the one that serves.

+8
source share

Approach 1: Using the API on a Wikimedia Wiki Farm

To get all the interwiki prefixes the wiki knows about, use the MediaWiki API metamode and request any project for siprop=interwikimap :

 https://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=interwikimap 

You will get a large array of such objects:

 { "prefix": "aa", "local": "", "language": "Qaf\u00e1r af", "url": "https://aa.wikipedia.org/wiki/$1", "protorel": "" } 

protorel tells you whether the URL is relative or not (i.e. starting with // ). For the WikiMedia wiki, they start with https . $1 in the url, like your imaginary, placeholder for the title.

To get only wikis in the same wikifarm (e.g. Wikimedia wikis ), add sifilteriw=local to your query:

 https://sv.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local 

To get names in your language, use siinlanguagecode like this (all Wikimedia wikis, with their Swedish names, are extracted from Arabic Wikipedia, but could be any endpoint in a wiki farm):

 https://ar.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local&siinlanguagecode=sv 

From here you need to filter, for example. Wikipedia yourself.

Approach 2: Using Wikistats in wmflabs

A list already filtered by project type is available at http://wikistats.wmflabs.org (csv), where you can filter Wikipedia, Wikiversity, etc. The csv file is updated daily, but the tool is experimental and may not be forever.

In any of the approaches Wikipedia Wikimedia Incubator does not appear.

+7
source share

Subtract closed.dblist from wikipedia.dblist ( other lists ), then remove the wiki from the end and replace _ with - .

+3
source share

All Articles