Wikipedia icon indicating copy to clipboard operation
Wikipedia copied to clipboard

Unable to fetch next 500 page links

Open Wiiseguy opened this issue 3 months ago • 4 comments

There is no pagination/offset setting in the listOptions parameter when calling page.links(). This means that only the first 500 links are fetched.

The limit of 500 itself is fine, but I am missing a way to get the next 500 links. I've checked the docs and there does not seem to be a way to do this.

Wiiseguy avatar Sep 07 '25 15:09 Wiiseguy

I experience the same issue Moreover, unless I misunderstood the API, it doesn't provide links that are relevant to the article but returns all of wikipedia links (sorted alphabetically), is that intended?

ethanshar avatar Sep 29 '25 05:09 ethanshar

@Wiiseguy thanks for opening the issue.

You are right that the package currently does not have a way to do this. We set a max limit to the page and do not have a way to get the rest of the items right now. Do you have an example of a page with more than 500 links so that we can use it as a test when writing the relevant code for this?

Reading through the wiki query docs, i see - https://www.mediawiki.org/wiki/API:Continue - we will need to handle this parameter in case of apis using listOptions so it can show the next 500.

@ethanshar i think the links returned are relevant to the page itself. Can you give an example of this issue?

dopecodez avatar Oct 27 '25 09:10 dopecodez

@dopecodez

Here's one: https://en.wikipedia.org/wiki/Special:WhatLinksHere/Microsoft

As a workaround for this issue I created a function that talks to the API directly and fetches links as long as there's a continue.plcontinue continue token in the response.

Wiiseguy avatar Oct 31 '25 12:10 Wiiseguy

@Wiiseguy thanks a lot. If you would be open to sharing the code of your function here or working on a PR on wikipedia, that would be welcome. I'll look into this once the other issues are closed if not.

dopecodez avatar Oct 31 '25 12:10 dopecodez