More powerful whatLinksHere()
Nirvanchik opened this issue · 3 comments
whatLinksHere() currently provides only a restricted set of Special:WhatLinksHere. The words "Equivalent to [[Special:Whatlinkshere]]" in API javadoc is not true.
In my case I want to get all links leading to page A including redirections and cannot do that with whatLinksHere().
For example:
X is redirect to A, Y is redirect to A
B has link to A,
C has link to X
D has link to Y.
So, I want to get all these pages B, C, D and cannot.
I made a simple fix to whatLinksHere() to help it (ACTUAL FOR V0.33):
if (linksViaRedirects)
url.append("&blredirect=1");
And it worked.
But recently the code of this method was rewritten (commit 36f456c) and I cannot apply this fix anymore.
Here is a simple test case code to test powerful whatLinksHere()
https://pastebin.com/5kW9Kp6X
I'll look at this once the Java 11 upgrade is complete - the only remaining problem is Google App Engine.
The change in the code was to use an alternative API call that allows fetching links to multiple pages in a single network request, but it does not take into consideration the use case in this ticket.
Thank you so much for this fix! It helps me a lot!