1

I have been racking my brain for a while with this task. I have tried, without success to use the Mediawiki Nuke extension and pywikibot. I am missing something simple here I know it. I can't seem to identify the pages correctly because none of the patterns I use in Mass Delete bring back any hits and pywikibot says Skipping: [[mediawiki:Some Page I want To Delete -- Page 1]] does not exist.

I am logged in as myself, bureaucrat and administrator. MW ver 1.26. I can delete a single page, while on the page and using the Delete option.

Nuke: I leave the username, ip field blank, I enter a title or portions of the title of pages in the Pattern for the page name on the Mass Delete page to no avail. What am I doing wrong?

Example: Some Page I want To Delete -- Page 1, Some Page%, %Some Page%

pywikibot: Maybe it's its my user-config.py?

family = 'mediawiki'
mylang = 'mediawiki'
usernames['mediawiki']['mediawiki'] = u'myname'

I created a file with the pages I want to delete.

File: delete_pages.txt

# [[Some Page I want To Delete -- Page 1]]
# [[Some Page I want To Delete -- Page 2]]
# [[Some Page I want To Delete -- Page 3]]

Sample output

C:\Users\me\pywikibot>\python34\python delete.py -file:delete_pages.txt
Enter a reason for the deletion:

>>> Some Page I want To Delete -- Page 1 <<<
Skipping: [[mediawiki:Some Page I want To Delete -- Page 1]] does not exist.

>>> Some Page I want To Delete -- Page 2 <<<
Skipping: [[mediawiki:Some Page I want To Delete -- Page 2]] does not exist.
etc

Edit:

I did get Nuke:Mass Delete to find some pages to delete. It would only find pages that were recent. I don't know what recent means, some pages it found but others not.

Phil
  • 306
  • 2
  • 10
  • see https://www.mediawiki.org/wiki/Topic:Tixb1x1ksygaby5c and https://phabricator.wikimedia.org/T248673 – Wolfgang Fahl Mar 27 '20 at 12:02
  • `mediawiki` is [mediawiki.org](https://www.mediawiki.org/). Do you really want to delete pages there? You are probably looking for [generate_family_file.py](https://www.mediawiki.org/wiki/Manual:Pywikibot/Use_on_third-party_wikis#Script_to_generate_family_file). – Tgr Oct 30 '16 at 06:03
  • This is a personal mediawiki installation, I have created that uses mediawiki software. – Phil Oct 31 '16 at 11:34
  • In this case, you have to [generate a custom family file](https://www.mediawiki.org/wiki/Manual:Pywikibot/Use_on_third-party_wikis#Script_to_generate_family_file) instead of using official mediawiki.org one. – framawiki Nov 25 '17 at 23:26

1 Answers1

0

I also struggled with this issue for a long time but then I came across a library called 'mwclient' in python. It's quite easy to implement too.

import mwclient
site = mwclient.Site(host='ml-concepts.com/wiki/', path='', retry_timeout=180)
site.login('USERNAME','PASSWORD')
pages = [page for page in site.pages]

for page in pages:
    if page.base_name == 'the title to be matched':
        page.delete(reason='spam')

sourabh gupta
  • 61
  • 1
  • 9