Manual:Pywikipediabot/delete.py

From MediaWiki.org
Jump to: navigation, search
Wikimedia-logo-meta.png

This page was moved from MetaWiki.
It probably requires cleanup – please feel free to help out. In addition, some links on the page may be red; respective pages might be found at Meta. Remove this template once cleanup is complete.

Language: English  • 한국어 • ‪中文(繁體)‬
Bug blank.svg
Subversion repository of Wikimedia has this file:
Bote Boas Vindas2.png
Pywikipediabot
scripts
Pywikipediabot Overview
Quick Start Guide
Installation
Installation (Mac)
Configuration
user-config.py
Non-Wikimedia wikis
Tutorial
Scripts
Development
Further help

v  d  e

This script can be used to delete pages en masse. You will need an admin account on the relevant wiki. Also add:

sysopnames['wikipedia']['en'] = 'adminname'

To user-config.py

Where ['wikipedia'] is the name of the the family in which you are working on.

'adminname' is the username.

[edit] Examples

  • Delete everything in the category "To delete" without prompting.

python delete.py -cat:"To delete" -always

  • Delete everything in the pages linked to the page, without prompting.

python delete.py "deletepage" -always

  • Delete pages inside a text file:

python delete.py -file:nuke.txt -always -summary:"Because I feel like it"

The format of the text file should be as the following:

# [[Main Page]]
# [[Talk:Main Page]]
  • Restore pages:

python delete.py -undelete -file:respawn.txt -summary:"It was a foolish mistake"

[edit] Arguments

  • -cat: Delete all pages in the given category.
  • -links: Delete all pages linked from a given page.
  • -always Don't prompt to delete pages, just do it.
  • -summary: Supply a custom edit summary.
  • -undelete: Actually undelete pages instead of deleting. Works only with -page and -file.
  • -file: Delete all pages listed in a given text file. The list should be of the format
    • # [[page1]]
    • # [[page2]]
    • etc.

[edit] Usage output

Usage is reported thus;

Global arguments available for all bots:

-lang:xx          Set the language of the wiki you want to work on, overriding
                  the configuration in user-config.py. xx should be the
                  language code.

-family:xyz       Set the family of the wiki you want to work on, e.g.
                  wikipedia, wiktionary, wikitravel, ...
                  This will override the configuration in user-config.py.

-log              Enable the logfile. Logs will be stored in the logs
                  subdirectory.

-log:xyz          Enable the logfile, using xyz as the filename.

-nolog            Disable the logfile (if it is enabled by default).

-putthrottle:nn   Set the minimum time (in seconds) the bot will wait between
                  saving pages.


This script can be used to delete and undelete pages en masse.
Of course, you will need an admin account on the relevant wiki.

Syntax: python delete.py [-cat:categoryName|-page:pageName|...] [-summary:"text"] [-undelete] [-always]

Command line options:

-page:       Delete specified page
-cat:        Delete all pages in the given category.
-links:      Delete all pages linked from a given page.
-file:       Delete all pages listed in a text file.
-ref:        Delete all pages referring from a given page.
-images:     Delete all images used on a given page.
-always:     Don't prompt to delete pages, just do it.
-summary:    Supply a custom edit summary.
-undelete:   Actually undelete pages instead of deleting.
             Obviously makes sense only with -page and -file.

Examples:

Delete everything in the category "To delete" without prompting.

    python delete.py -cat:"To delete" -always
Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox