Jump to content

API talk:Links

About this board

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?"

How are links defined?

2
Jdfoote (talkcontribs)
RobinHood70 (talkcontribs)

Links are defined as both direct links in the body of the article itself, as well as links found in templates that are embedded in the article. So, using the two you mentioned, both can be found linked at the very bottom of the article in the auto-hidden footer "Links to related articles", then either "Association of American Universities" or "Universities Research Association".

Reply to "How are links defined?"

Links used as generator and sequence order

1
CXuesong (talkcontribs)

I created a sandbox page on w:User:CXuesong/sandbox/1, and used prop=links to get all the linked pages. Note the sequence is ordered alphabetically here. Then I used generator instead. The result is unordered. As I have told in API talk:Search, for certain generators, they have "index" property in the JSON response and I can reorder the returned items, but for this case, there is no such property.

I'm not seeking for a change on the API. I just wonder, can I assume that the items in the pages property in the JSON response of generators are inherently unordered? (After all, it's a dictionary.) Because I have used generator=recentchanges to enumerate all the pages that have been changed recently, and I used to assume they are ordered chronologically. Was I wrong at that time?

Reply to "Links used as generator and sequence order"

Links from previous revision of Wikipedia article(s)

2
Rodricios (talkcontribs)

As the subject implies, I'm interested in getting the links on Wikipedia article provided a revision id, or possibly a date. Are there any thoughts on this?

RobinHood70 (talkcontribs)
Reply to "Links from previous revision of Wikipedia article(s)"
There are no older topics