On Tue, Feb 25, 2020 at 1:27 AM MusikAnimal <musikani...@gmail.com> wrote:

> Unfortunately there's no proper log of redirect changes (I recently filed <
> https://phabricator.wikimedia.org/T240065> for this). There are change
> tags
> <https://www.mediawiki.org/wiki/Help:Tags> that identify redirect changes
> -- "mw-new-redirect" and "mw-changed-redirect-target", specifically -- but
> I am not sure if this is easily searchable via the action API. Someone on
> this list might know.
>

You can do
https://en.wikipedia.org/w/api.php?action=query&titles=2019%E2%80%9320%20Wuhan%20coronavirus%20outbreak&prop=revisions&rvprop=timestamp|tags|ids|content&rvlimit=max&rvtag=mw-new-redirect&formatversion=2&rvslots=main
or
https://en.wikipedia.org/w/api.php?action=query&titles=2019%E2%80%9320%20Wuhan%20coronavirus%20outbreak&prop=revisions&rvprop=timestamp|tags|ids|content&rvlimit=max&rvtag=mw-changed-redirect-target&formatversion=2&rvslots=main
(You cannot do both in one query, you can only specify one tag at a time).
Furthermore, it looks like given a revision id, you would have to determine
where it redirects yourself, which is unfortunate. I suppose you could look
at
https://en.wikipedia.org/w/api.php?action=parse&oldid=941491141&formatversion=2&prop=text|links
(taking the oldid as the revid from the other query) and either try and
parse the html, or just assume if there is only one main namespace link,
that that is the right one.

Also keep in mind, really old revisions won't have those tags.

--
Brian
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to