You may find Writ Keeper's massRevdel
<https://en.wikipedia.org/wiki/User:Writ_Keeper/Scripts/massRevdel.js>
helpful. It allows you to mass hide from Special:Contributions.

Regards,
JJ


On Thu, Apr 11, 2024 at 1:39 AM Bináris <wikipo...@gmail.com> wrote:

> *TL;DR*: we can mass hide vandal revisions from pages histories, e.g.
> obscene images and edit comments.
>
> Of course, this needs admin rights.
> It is easy to mass hide revisions from the history of one page without
> bot, just click checkboxes. But it is tiring, if several pages are involved.
>
> I wrote a script that is not ready to publish, and I won't show it for the
> vandal, and needs manual editing. But I can send it in a private mail to
> those who are interested.
>
> The API documentation is here:
> https://www.mediawiki.org/wiki/API:Revisiondelete
> But it is not complete. I learned on my own that multiple revids may
> concern the same page. We don't have to write the title into the request,
> but must group the revisions by page.
> The required format is e.g. 27009438|27009402|27009353|27009335|27009151
> with pipe, all ids belong to the same page, otherwise they won't all be
> processed, just the first page. This is an undocumentetd feature. :-)
>
> Sample code fragment (run with -user:myadminaccount):
>
> hide = 'content|comment|user'  # Just to show the syntax, keep what you
> need
> reason = 'Vandalism'
>
> def gen() -> Iterator[str]:
>     """Yield ids to hide in the above form, page by page. Here comes your
> work."""
>     yield' 27009438|27009402|27009353|27009335|27009151'  # Example
>
> token = site.get_tokens(['csrf']).get('csrf')  # get a single token
> for ids in gen():
>     params = {'action': 'revisiondelete',
>               'type': 'revision',
>               'ids': ids,
>               'hide': hide,
>               'token': token,
>               'reason': reason,
>              }
>     request = site.simple_request(**params)
>     request.submit()
>
> To get the ids use for contrib in user.contributions():
> contrib[0] will be the page object, while  contrib[1] the revision id for
> each contribution.
> --
> Bináris
> _______________________________________________
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/2S64RSANNYDCFJPRMHPEP6TAJ7BAXV7M/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>
_______________________________________________
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/IGCPHPNVPBEFF3V4SSHHHQW4BIEMTLUL/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org

Reply via email to