如何获取“所有带有前缀的页面"的结果使用维基百科api? [英] How to get the result of "all pages with prefix" using Wikipedia api?

查看:19
本文介绍了如何获取“所有带有前缀的页面"的结果使用维基百科api?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用维基百科的api来提取这个页面的结果:

I wish to use Wikipedia api to extract the result of this page:

http://en.wikipedia.org/wiki/Special:PrefixIndex

在其上搜索某物"时,例如:

When searching "something" on it, for example this:

http://en.wikipedia.org/w/index.php?title=Special%3APrefixIndex&prefix=tal&namespace=4

然后,我想访问每个结果页面并提取它们的信息.

Then, I would like to access each of the resulting pages and extract their information.

我可以使用什么 API 调用?

What api call might I use?

推荐答案

您可以使用 list=allpages 并指定 apprefix.例如:

You can use list=allpages and specify apprefix. For example:

http://en.wikipedia.org/w/api.php?format=xml&action=query&list=allpages&apprefix=tal&aplimit=max

此查询将为您提供以 tal 开头的每篇文章的 ID 和标题.如果您想获取有关每个页面的更多信息,可以将此列表用作 生成器:

This query will give you the id and title of each article that starts with tal. If you want to get more information about each page, you can use this list as a generator:

http://en.wikipedia.org/w/api.php?format=xml&action=query&generator=allpages&gapprefix=tal&gaplimit=max&prop=info

您可以为 prop 参数赋予不同的值以获取有关页面的不同信息.

You can give different values to the prop parameter to get different information about the page.

这篇关于如何获取“所有带有前缀的页面"的结果使用维基百科api?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆