使用维基百科 API 获取内容 [英] Getting content using wikipedia API
本文介绍了使用维基百科 API 获取内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过单个请求获取维基百科文章的整个第一部分/段落,包括第一张图片?
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
推荐答案
如果您想要维基文本,请使用 prop=revisions
与 rvsection=0
.如果你想要 HTML,你可以添加 rvparse=1
到该查询,或者您可以使用 action=parse
.
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
.
这篇关于使用维基百科 API 获取内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文