Is it possible to obtain the full HTML of a wiki page via the Mediawiki API? I’m looking for the API equivalent of:
wget https://en.wikipedia.org/wiki/Example
Reason: Our wiki requires a login in order to read articles. So "wget" produces only a "Login required" page. I can log in via API, but can't figure out how to obtain the HTML, just the wikitext (action=query, prop=revisions, rvprop = content).
Other solutions are welcome too....
Thanks, DanB
You can do this with the action=parse API. https://www.mediawiki.org/wiki/API:Parsing_wikitext#parse
There's also index.php?action=render (https://en.wikipedia.org/w/index.php?title=Example&action=render), which is technically not deprecated, but please use the API if possible ;)
On Tue, Apr 5, 2016 at 4:58 PM, Bartosz Dziewoński matma.rex@gmail.com wrote:
You can do this with the action=parse API. https://www.mediawiki.org/wiki/API:Parsing_wikitext#parse
Note this doesn't give the *full* HTML as you'd get by fetching the article from the web UI, as it omits the wrapping HTML from the skin and other chrome. I don't think there's any way to fetch the full page HTML including skin and other chrome from the API.
You can get the raw "full" HTML using the Revisions API
https://www.mediawiki.org/wiki/API:Revisions
Thad +ThadGuidry https://www.google.com/+ThadGuidry https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Bartosz Dziewonski writes:
You can do this with the action=parse API. https://www.mediawiki.org/wiki/API:Parsing_wikitext#parse
Thanks. Here's the data I posted through the API, for posterity:
$pageData = array( 'action' => 'parse', 'prop' => 'text', 'page' => $pageName, // page title 'format' => 'json', 'redirects' => true, 'disablepp' => true, 'disableeditsection' => true, );
DanB
mediawiki-api@lists.wikimedia.org