Retrieving the Interlanguage links from an exported Wikipedia article?

别来无恙 提交于 2019-12-05 00:25:08

问题


I used to retrieve the interlanguage links from an exported Wikipedia article by parsing the export with some regular expressions.

In phase 1 of the WikiData project these links have been moved to a separate page on Wikidata.

For example the article Ore Mountains has no language links anymore in the export. The language links are now on Q4198.

How can I export the language links?


回答1:


You are now encouraged to use the Wikidata aPI : http://wikidata.org/w/api.php

For your case, use props=labels. This url is self explicative :

http://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwiki&titles=Ore%20Mountains&languages=cs|de|es|fr|it|pl|pt|ru&props=labels&format=xml



回答2:


I changed from using the export to the API. You can retrieve the interwikilanguage links with the property "langlinks", like this:

http://en.wikipedia.org/w/api.php?action=query&titles=Ore%20Mountains&prop=langlinks



来源:https://stackoverflow.com/questions/16629874/retrieving-the-interlanguage-links-from-an-exported-wikipedia-article

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!