问题
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