Get neat content from Wiki page. (MediaWiki API)
I want to get a content page from Wiki 开发者_Go百科in this format (the picture below) then show it in WebView. It means the content includes text and links.
I tried this but the output seems to be messy. http://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&titles=Albert_Einstein&format=xmlfm
I stumbled across this answer a year later and would like to note that the ?action=render
parameter has been depreciated as of this post.
The recommended method is to use the Mediawiki API to parse the wikitext.
You want index.php?action=render
; an example. This returns the HTML of the page content with no sidebar/header/footer HTML. You'll have to match and remove infoboxes yourself.
Reference: MediaWiki — Manual:Parameters to index.php.
You can use HTML generated by mediawiki instead of wikicode.
BTW: look at this
精彩评论