Search code examples
wikipediawikipedia-apimediawiki-apiwikimedia

Retrieve a list of all Wikipedia languages programmatically


I need to retrieve a list of all existing languages for a certain wiki project. For example, all Wikivoyage or all Wikipedia languages, just like on their landing pages.

I prefer to do this via MediaWiki API, if it's possible.

Thanks for your time.


Solution

  • Approach 3: Using an API in the Wikimedia wiki farm and Extension:Sitematrix

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

    While this will return all wikis, the matrix knows about, it is easily filtered client side by code [as of now, one of: wiki (Wikipedia), wiktionary, wikibooks, wikinews, wikiquote, wikisource, wikiversity, wikivoyage] and by its closed state. One request with just some response body overhead but since it's easily cached and compresses well, not that serve.