Topic on API talk:Links

Not all external links shown?

3
Inductiveload (talkcontribs)
RobinHood70 (talkcontribs)

The IA template is using an Interwiki link to link to the Internet Archive instead of a direct external link. So, to find it, you'd have to use the iwlinks module instead of extlinks, like this: https://commons.wikimedia.org/w/api.php?action=query&format=jsonfm&prop=iwlinks&titles=File%3AThe_Works_of_Arthur_Murphy_-_Volume_4.djvu&iwlimit=100. If you look for "iarchive" in the results, that's the link you want.


The obvious problem there is that you have no guarantee that people are using the IA template. They could be specifying the address as a normal http link instead. So, you'd probably want to check both at the same time with this query: https://commons.wikimedia.org/w/api.php?action=query&format=jsonfm&prop=extlinks|iwlinks&titles=File%3AThe_Works_of_Arthur_Murphy_-_Volume_4.djvu&ellimit=100&iwlimit=100


There's also API:Parsing wikitext, which can do some things that property queries can't. I don't think it would do anything useful in this instance, but I don't use it myself, so you may want to poke around it a little to see if there's anything useful there.

Inductiveload (talkcontribs)

Thank you very much! I was parsing the wikitext before and looking for the right href, but this is a much better solution!

Reply to "Not all external links shown?"