使用维基百科 API 获取内容
如何通过单个请求获取维基百科文章的整个第一部分/段落,包括第一张图片?
到目前为止我所尝试的(以下网址)仅返回一个片段:
http://en.wikipedia.org/w/api.php?format=xml&action=query&list=search&srsearch=camera&srlimit=1
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想要维基文本,请使用
prop=revisions
与rvsection=0
。如果您需要 HTML,可以添加rvparse=1
到该查询,或者您可以使用action=parse
< /a>.If you're wanting the wikitext, use
prop=revisions
withrvsection=0
. If you're wanting HTML, you can addrvparse=1
to that query or you can useaction=parse
.在一个请求中不可能做到这一点。
It's not possible to do that in one request.