如何获得的&QUOT的结果;用preFIX&QUOT所有页面;维基百科使用API​​? [英] How to get the result of "all pages with prefix" using Wikipedia api?

查看:147
本文介绍了如何获得的&QUOT的结果;用preFIX&QUOT所有页面;维基百科使用API​​?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用维基百科的API提取该页面的结果是:

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

http://en.wikipedia.org/wiki/Special:$p$ pfixIndex

在搜索就可以了东西,比如这个:

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

<一个href=\"http://en.wikipedia.org/w/index.php?title=Special%3A$p$pfixIndex&$p$pfix=tal&namespace=4\" rel=\"nofollow\">http://en.wikipedia.org/w/index.php?title=Special%3A$p$pfixIndex&$p$pfix=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?

推荐答案

您可以使用列表=所有页并指定 AP preFIX 。例如:

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

<一个href=\"http://en.wikipedia.org/w/api.php?format=xml&action=query&list=allpages&ap$p$pfix=tal&aplimit=max\" rel=\"nofollow\">http://en.wikipedia.org/w/api.php?format=xml&action=query&list=allpages&ap$p$pfix=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:

<一个href=\"http://en.wikipedia.org/w/api.php?format=xml&action=query&generator=allpages&gap$p$pfix=tal&gaplimit=max&prop=info\" rel=\"nofollow\">http://en.wikipedia.org/w/api.php?format=xml&action=query&generator=allpages&gap$p$pfix=tal&gaplimit=max&prop=info

您可以在参数给出不同的值,以获取有关该页面的不同信息。

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

这篇关于如何获得的&QUOT的结果;用preFIX&QUOT所有页面;维基百科使用API​​?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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