Search code examples
wikipedia-apiwikimedia

Wikimedia API: How to get page contents


I am trying to get the content of the wikimedia pages like these ones:

https://meta.wikimedia.org/wiki/MediaWiki:Centralnotice-FR2015_translations-smallamount-error

https://meta.wikimedia.org/wiki/MediaWiki:FundraisingBanners/SmallPrint-2017

I am working on something related to translations and banners but I'm stuck in this step.

I've been testing several of the endpoints in this API https://www.mediawiki.org/w/api.php with not succeed.

Could you help me please?


Solution

  • These are what you want:

    https://meta.wikimedia.org/w/api.php?action=query&prop=revisions&rvslots=*&rvprop=content&format=json&titles=MediaWiki:Centralnotice-FR2015_translations-smallamount-error
    
    https://meta.wikimedia.org/w/api.php?action=query&prop=revisions&rvslots=*&rvprop=content&format=json&titles=MediaWiki:FundraisingBanners/SmallPrint-2017
    

    Let me know if you're struggling to extract the content from those.