Getting content using wikipedia API

不问归期 提交于 2019-12-04 06:24:31

问题


How can I get the entire first section/paragraph of a Wikipedia article including the first image with a single request?

What I've tried so far (the following url) returns only a snippet:

http://en.wikipedia.org/w/api.php?format=xml&action=query&list=search&srsearch=camera&srlimit=1


回答1:


If you're wanting the wikitext, use prop=revisions with rvsection=0. If you're wanting HTML, you can add rvparse=1 to that query or you can use action=parse.




回答2:


How can I get the entire first section/paragraph of a Wikipedia article including the first image with a single request?

It's not possible to do that in one request.



来源:https://stackoverflow.com/questions/6399456/getting-content-using-wikipedia-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!