使用维基百科 API 获取内容

发布于 2024-11-16 14:26:47 字数 334 浏览 5 评论 0原文

如何通过单个请求获取维基百科文章的整个第一部分/段落,包括第一张图片?

到目前为止我所尝试的(以下网址)仅返回一个片段:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

温柔戏命师 2024-11-23 14:26:47

如果您想要维基文本,请使用 prop=revisionsrvsection=0。如果您需要 HTML,可以添加 rvparse=1 到该查询,或者您可以使用 action=parse< /a>.

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.

感性不性感 2024-11-23 14:26:47

如何通过单个请求获取维基百科文章的整个第一部分/段落,包括第一张图片?

在一个请求中不可能做到这一点。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文