从 Wiki 页面获取简洁的内容。 (MediaWiki API)
我想以这种格式从 Wiki 获取内容页面(如下图),然后在 WebView 中显示它。这意味着内容包括文本和链接。
我尝试了这个,但输出似乎很混乱。 http://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&titles=Albert_Einstein&format=xmlfm
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.
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你想要
index.php?action=render
; 示例。这将返回页面内容的 HTML,不包含侧边栏/页眉/页脚 HTML。您必须自己匹配和删除信息框。参考:MediaWiki — 手册:index.php 的参数。
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.
您可以使用 mediawiki 生成的 HTML 而不是 wikicode。
顺便说一句:看看这个
You can use HTML generated by mediawiki instead of wikicode.
BTW: look at this
一年后我偶然发现了这个答案,并想指出
?action=render
参数 截至本文已贬值。推荐的方法是使用 Mediawiki API 解析 wiki 文本。
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.