Jump to content

API talk:Iwlinks

Add topic
From mediawiki.org

Why does this not return any interwiki links though the Wikipedia page obviously has a lot of them? PeterHeuz (talk) 15:41, 13 November 2018 (UTC)Reply

I'm not seeing any interwiki links on that page. What are you seeing? Try links, extlinks, or langlinks and see if they have what you're looking for. Robin Hood  (talk) 20:23, 13 November 2018 (UTC)Reply
Thanks for your quick reply!
I mean this page: https://en.wikipedia.org/wiki/Data_science . To my understanding there are a lot of interwiki links. When I use extlinks it works perfectly. So that should be a valid value for the titles parameter. PeterHeuz (talk) 14:04, 19 November 2018 (UTC)Reply
Unless I've missed something, there are no interwiki links on that page apart from the language links (which are their own thing and aren't considered interwiki links for the purposes of the API). Just to be sure we're using the same terminology:
Regular wiki link = [[Template:link]] (links to the current wiki)
Interwiki link = [[wikt:Template:link]] (links to a different wiki - wiktionary in this example)
Language link = [[fr:Template:link]] (links to a different language variant of the wiki - the French wikipedia in this example)
External link = [http://google.com] (links to an external site - Google in this example)
If you're seeing actual interwiki links on that page, can you please highlight what they are? Also, be aware that if they're generated by a template, I don't believe Iwlinks would pick them up. Robin Hood  (talk) 23:01, 19 November 2018 (UTC)Reply
Thanks for the reply!
Indeed, I was thinking of interwiki links as links to other wikipedia articles. Our tutor gave us this task and she meant links to other wikipedia articles.
So, there is no parameter to grab those all together without other links, is there? I would therefore use the links property and just remove the extlinks from those. PeterHeuz (talk) 14:25, 20 November 2018 (UTC)Reply
There shouldn't be any external links in the links list, I don't think. This is what I used and I didn't notice any:
https://en.wikipedia.org/w/api.php?action=query&titles=Data%20science&prop=links&pllimit=max
If you strictly wanted the articles, though, then yes, you would filter that list to only those that have ns:0. Robin Hood  (talk) 19:31, 20 November 2018 (UTC)Reply