Wikipedia – How to Download Wikicode of a Wikipedia Page

mediawikiwikipedia

I want to download the wikicode of this Wikipedia article with a single Web request.

Is there any better way than getting https://en.wikipedia.org/w/index.php?title=Paris&action=edit and filtering the content of the <textarea>?

In particular, how to do this with the REST API?

Best Answer

Passing action=raw is the best way to obtain just the wikitext of a page, although it can be done with the API. See https://en.wikipedia.org/w/index.php?title=Paris&action=raw for example and the MediaWiki docs.