Getting cross-language links from an exported Wikipedia article?

I used to extract cross-language links from the exported Wikipedia article, analyzing the export with some regular expressions.

In phase 1 of the WikiData project , these links were moved to a separate page in Wikidata.

For example, in the Ore Mountains article there are no more language links in the export. Language references are now on Q4198 .

How can I export language links?

+6
source share
2 answers

I changed the use of export in the API. You can get cross-language links with the "langlinks" property, for example:

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

+1
source

Now you are invited to use Wikipedia aPI: http://wikidata.org/w/api.php

For your case, use the details = tags . This url is self-evident:

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 
+5
source

Source: https://habr.com/ru/post/945338/


All Articles