On Sun, May 29, 2016 at 3:12 PM, Brad Jorsch (Anomie) <bjorsch(a)wikimedia.org
> On Sat, May 28, 2016 at 8:42 AM, Nicolas Vervelle <nvervelle(a)gmail.com>
>> I find that the result of list=backlinks for page XXX is odd when one of
>> the backlinks is a redirect on a different page than XXX, but has also
>> contents with a link to XXX.
>> See for example backlinks to en:Spin-off
>> Among the backlinks, there's for example "User talk:SummerPhD" and
>> pages linking to this talk page :
>> - It's content contains a link to Spin-off page, so it's normal to
>> see it.
>> - It's also a redirect (bad practice to have a redirect page with
>> contents), so all backlinks to this talk page are also listed while they
>> have no relation at all to "Spin-off"
>> Is it normal to have this behaviour ?
> This is the documented behavior: the description of the blredirect
> parameter says "If linking page is a redirect, find all pages that link
> to that redirect as well." [[Spin-off]] is indeed linked from [[User
> talk:SummerPhD]], and [[User talk:SummerPhD]] is indeed a redirect.
> If you're looking for actual redirects to [[Spin-off]] rather than all
> redirect pages that link to [[Spin-off]], you want to use prop=redirects
> instead. You might also consider using prop=linkshere instead of
> list=backlinks, as the former allows you to specify multiple titles at the
> cost of not having a "blredirect"-style subquery.
> : https://en.wikipedia.org/w/api.php?modules=query+backlinks
> : https://en.wikipedia.org/w/api.php?modules=query+redirects
> : https://en.wikipedia.org/w/api.php?modules=query+linkshere
Thanks for the answer Brad,
If I want to retrieve all pages that link to a given page (either directly
or through a redirect), what request(s) should I perform ?
If I understand correctly:
- with backlinks I have the problem I mentionning in my first email
- with redirects I only get the list of redirects so I also have to
retrieve the list of links to the initial page and to all the redirects
- with linkshere I only get the list of pages with a direct link, and I
can't tell for redirects if they are to the given page or to an other
So, my guess is "redirects" then "linkshere" for Spin-off and all
redirects given by the first request?
Brad Jorsch (Anomie)
Senior Software Engineer
Mediawiki-api mailing list