Jump to content

API talk:Exturlusage: Difference between revisions

Add topic
From mediawiki.org
Latest comment: 9 months ago by Ciencia Al Poder in topic Usage of eucontinue
Content deleted Content added
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Flow-enabled}}
{{flow imported revision}}
== Usage of eucontinue ==
== Usage of eucontinue ==


Line 10: Line 10:
Thank you! [[User:Aw8988|Aw8988]] ([[User talk:Aw8988|talk]]) 04:45, 29 April 2021 (UTC)
Thank you! [[User:Aw8988|Aw8988]] ([[User talk:Aw8988|talk]]) 04:45, 29 April 2021 (UTC)
:The example in [[API:Exturlusage#Response]] returns a "continue" property, which in turn contains "eucontinue" and "continue". You should append/merge both on the next request to continue pagination, until you no longer get a "continue" property in the response. [[User:Ciencia Al Poder|Ciencia Al Poder]] ([[User talk:Ciencia Al Poder|talk]]) 08:07, 29 April 2021 (UTC)
:The example in [[API:Exturlusage#Response]] returns a "continue" property, which in turn contains "eucontinue" and "continue". You should append/merge both on the next request to continue pagination, until you no longer get a "continue" property in the response. [[User:Ciencia Al Poder|Ciencia Al Poder]] ([[User talk:Ciencia Al Poder|talk]]) 08:07, 29 April 2021 (UTC)
::Domains like doi.org and nih.gov have millions of external links. Which means following 'eucontinue' for each set of 500 results would require thousands of API requests just to get all results for a single domain. Is there some other way to get the total number of external links for a domain ('exturlusage'), or the total number of expected 'eucontinue's ,without paginating thru each one? [[User:Hearvox|Hearvox]] ([[User talk:Hearvox|talk]]) 14:29, 1 November 2025 (UTC)
:::If you have database access, you can query the [[Manual:externallinks table|externallinks table]] directly. On WMF there's a [[meta:Research:Quarry|service]] to allow some queries. For example: [https://quarry.wmcloud.org/query/98720 Count the number of external links to the domain doi.org (http and https) on enwiki] [[User:Ciencia Al Poder|Ciencia Al Poder]] ([[User talk:Ciencia Al Poder|talk]]) 10:45, 2 November 2025 (UTC)


== API on Dutch Wikipedia does not seem to work ==
== API on Dutch Wikipedia does not seem to work ==
Line 15: Line 17:
The call [https://nl.wikipedia.org/w/api.php?action=query&list=exturlusage&eulimit=100&eunamespace=0&format=json&euquery=https://www.dbnl.org/ https://nl.wikipedia.org/w/api.php?action=query&list=exturlusage&eulimit=100&eunamespace=0&format=json&euquery=https://www.dbnl.org] gives zero results, while the Dutch article https://nl.wikipedia.org/w/index.php?title=Theodoor%20van%20Ryswyck&action=edit clearly contains the URL "<nowiki>https://www.dbnl.org</nowiki>"
The call [https://nl.wikipedia.org/w/api.php?action=query&list=exturlusage&eulimit=100&eunamespace=0&format=json&euquery=https://www.dbnl.org/ https://nl.wikipedia.org/w/api.php?action=query&list=exturlusage&eulimit=100&eunamespace=0&format=json&euquery=https://www.dbnl.org] gives zero results, while the Dutch article https://nl.wikipedia.org/w/index.php?title=Theodoor%20van%20Ryswyck&action=edit clearly contains the URL "<nowiki>https://www.dbnl.org</nowiki>"


The equivalent call in the WPNL frontend seems to work: https://nl.wikipedia.org/wiki/Speciaal:VerwijzingenZoeken?target=https%3A%2F%2Fwww.dbnl.org


A modified call with a variant value of "euquery" does seem to work : https://nl.wikipedia.org/w/api.php?action=query&list=exturlusage&eulimit=100&eunamespace=0&format=json&euquery=dbnl.nl [[User:OlafJanssen|OlafJanssen]] ([[User talk:OlafJanssen|talk]]) 12:17, 21 November 2024 (UTC)
A modified call with a variant value of "euquery" does seem to work : https://nl.wikipedia.org/w/api.php?action=query&list=exturlusage&eulimit=100&eunamespace=0&format=json&euquery=dbnl.nl [[User:OlafJanssen|OlafJanssen]] ([[User talk:OlafJanssen|talk]]) 12:17, 21 November 2024 (UTC)
:Self-solved this issue: apparently you need to specify the "euprotocol=https" explicitly
:https://nl.wikipedia.org/w/api.php?action=query&list=exturlusage&eulimit=100&eunamespace=0&format=json&euprotocol=https&euquery=www.dbnl.org
:However, this is not stated correctly in the documentation : "If empty and <var>euquery</var> is set, the protocol is <kbd>http</kbd> and <kbd>https</kbd>"
:https://nl.wikipedia.org/w/api.php?action=query&list=exturlusage&eulimit=100&eunamespace=0&format=json&euprotocol=&euquery=www.dbnl.org gives 0 results [[User:OlafJanssen|OlafJanssen]] ([[User talk:OlafJanssen|talk]]) 12:29, 21 November 2024 (UTC)

Latest revision as of 10:45, 2 November 2025

Usage of eucontinue

[edit source]

Hello! I would like to get the number of links to a specific domain on Wikipedia (in my particular case the links to institutional repositories on different versions of wikipedia). This work perfectly fine as long as the number of links doesn't exceed 500.

I have seen the `eucontinue` parameter in the documentation but I couldn't figure out how to use it in an (iterative) API request.

Could anybody provide an example (maybe based on `get_exturlusage.py`) of how to use the eucontinue parameter?

Thank you! Aw8988 (talk) 04:45, 29 April 2021 (UTC)Reply

The example in API:Exturlusage#Response returns a "continue" property, which in turn contains "eucontinue" and "continue". You should append/merge both on the next request to continue pagination, until you no longer get a "continue" property in the response. Ciencia Al Poder (talk) 08:07, 29 April 2021 (UTC)Reply
Domains like doi.org and nih.gov have millions of external links. Which means following 'eucontinue' for each set of 500 results would require thousands of API requests just to get all results for a single domain. Is there some other way to get the total number of external links for a domain ('exturlusage'), or the total number of expected 'eucontinue's ,without paginating thru each one? Hearvox (talk) 14:29, 1 November 2025 (UTC)Reply
If you have database access, you can query the externallinks table directly. On WMF there's a service to allow some queries. For example: Count the number of external links to the domain doi.org (http and https) on enwiki Ciencia Al Poder (talk) 10:45, 2 November 2025 (UTC)Reply

API on Dutch Wikipedia does not seem to work

[edit source]

The call https://nl.wikipedia.org/w/api.php?action=query&list=exturlusage&eulimit=100&eunamespace=0&format=json&euquery=https://www.dbnl.org gives zero results, while the Dutch article https://nl.wikipedia.org/w/index.php?title=Theodoor%20van%20Ryswyck&action=edit clearly contains the URL "https://www.dbnl.org"

The equivalent call in the WPNL frontend seems to work: https://nl.wikipedia.org/wiki/Speciaal:VerwijzingenZoeken?target=https%3A%2F%2Fwww.dbnl.org

A modified call with a variant value of "euquery" does seem to work : https://nl.wikipedia.org/w/api.php?action=query&list=exturlusage&eulimit=100&eunamespace=0&format=json&euquery=dbnl.nl OlafJanssen (talk) 12:17, 21 November 2024 (UTC)Reply

Self-solved this issue: apparently you need to specify the "euprotocol=https" explicitly
https://nl.wikipedia.org/w/api.php?action=query&list=exturlusage&eulimit=100&eunamespace=0&format=json&euprotocol=https&euquery=www.dbnl.org
However, this is not stated correctly in the documentation : "If empty and euquery is set, the protocol is http and https"
https://nl.wikipedia.org/w/api.php?action=query&list=exturlusage&eulimit=100&eunamespace=0&format=json&euprotocol=&euquery=www.dbnl.org gives 0 results OlafJanssen (talk) 12:29, 21 November 2024 (UTC)Reply