[pywikibot] Re: Mass hide revisions

2024-04-11 Thread Bináris
Thanks, we'll try it! It is useful for admins without Pywikibot.

JJMC89  ezt írta (időpont: 2024. ápr. 11., Cs,
17:10):

> You may find Writ Keeper's massRevdel
> 
> helpful. It allows you to mass hide from Special:Contributions.
>
> Regards,
> JJ
>
>
> On Thu, Apr 11, 2024 at 1:39 AM Bináris  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
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/K2N44YD3UGLO2ZKGDZJ2WBT7QFAUXYQ6/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Mass hide revisions

2024-04-11 Thread JJMC89
You may find Writ Keeper's massRevdel

helpful. It allows you to mass hide from Special:Contributions.

Regards,
JJ


On Thu, Apr 11, 2024 at 1:39 AM Bináris  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