如何获取“所有带有前缀的页面"的结果使用维基百科api? [英] How to get the result of "all pages with prefix" using Wikipedia 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:
您可以为 prop
参数赋予不同的值以获取有关页面的不同信息.
You can give different values to the prop
parameter to get different information about the page.
这篇关于如何获取“所有带有前缀的页面"的结果使用维基百科api?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!