emeraldhieu
emeraldhieu

Reputation: 9439

Get neat content from Wiki page. (MediaWiki API)

I want to get a content page from Wiki in this format (the picture below) then show it in WebView. It means the content includes text and links.

Einstein

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

Upvotes: 2

Views: 3616

Answers (3)

ckoerner
ckoerner

Reputation: 51

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.

Upvotes: 5

Kevin Reid
Kevin Reid

Reputation: 43902

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.

Upvotes: 4

Bulwersator
Bulwersator

Reputation: 53

You can use HTML generated by mediawiki instead of wikicode.

BTW: look at this

Upvotes: 0

Related Questions