Dar*_*n V 0 wikipedia wikipedia-api
我有一个查询,获取维基百科文章中的所有链接.问题是对于某些页面,它不返回任何链接.
这篇维基百科文章有很多链接.但是,我的查询:
仅返回:
<?xml version="1.0"?>
<api>
<query>
<normalized>
<n to="Maramures County" from="Maramures_County"/>
</normalized>
<pages>
<page title="Maramures County" ns="0" pageid="3625444">
<links>
<pl title="Maramure? County" ns="0"/>
</links>
</page>
</pages>
</query>
</api>
Run Code Online (Sandbox Code Playgroud)
如果我对另一篇文章运行相同的查询,喜欢"月亮",我会得到很多结果.
返回
<?xml version="1.0"?>
<api>
<query-continue>
<links plcontinue="19331|0|JSTOR"/>
</query-continue>
<query>
<pages>
<page title="Moon" ns="0" pageid="19331">
<links>
<pl title="3753 Cruithne" ns="0"/>
<pl title="51st state" ns="0"/><pl title="Ablation" ns="0"/>
[ ... etc, etc ...]
Run Code Online (Sandbox Code Playgroud)
我是在做API的错误还是这个错误?
实际上,这篇文章Maramures County是一个重定向Maramure? County(注意下面的逗号),这意味着它在技术上是一篇文章,其中包含指向重定向目标的单个链接.
要获取链接,您可以使用实际文章的名称:
或者你可以使用redirects参数: