Manual:Pywikipediabot/redirect.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.

Bug blank.svg
Subversion repository of Wikimedia has this file:
Language: English  • Italiano • Русский
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

Script which fixes double redirects, and deletes broken redirects.

Requires access to MediaWiki's maintenance pages or to a XML dump file. Delete function requires adminship.

[edit] Syntax

Syntax:

 python redirect.py action [-argument]

where action can be one of these:

  • double - fix redirects which point to other redirects
  • broken - delete redirects where targets don't exist. Requires adminship, otherwise it will paste db-r1 to call a human admin.

and argument (optional) can be:

  • xml:filename.xml - Retrieve information from a local XML dump (http://download.wikimedia.org). If this argument isn't given, info will be loaded from a special page of the live wiki. Cannot be used with moves or api.
  • api - Retrieve information using Mediawiki's API. Cannot be used with xml.
  • moves - Instead of using Special:Doubleredirects, use the page move log to find double-redirect candidates (only works with action "double", does not work with -xml)
  • namespace:n - Namespace to process. Works only with an XML dump or API. Can be repeated multiple times.
  • offset:n - With XML number of redirect to restart with (see progress). With -moves, the number of hours ago to start scanning moved page
  • always - Don't prompt you for each replacement.
  • start:page - with API start page
  • until:page - with API last page
  • number:page - with API number of pages to process

If neither api nor api nor moves are present, information will be loaded using a special page

[edit] Example

This syntax fixes all the double redirects. Since no argument is defined, it uses Special:DoubleRedirects of the live wiki to find double redirects by default. It will ask for confirmation before making changes:

 redirect.py double

Global arguments available for all bots

arg Description Default
-family:xyz Set the family of the wiki you want to work on, e.g. wikipedia, wiktionary, commons, wikitravel, …. This will override the configuration in user-config.py settings. user-config.py parameter: family
-lang:xx Set the language of the wiki you want to work on, overriding the configuration in user-config.py where xx should be the language code[1]. user-config.py parameter: mylang
-log Enable the logfile. Logs will be stored in the logs subdirectory. user-config.py parameter: log ?
-log:xyz Enable the logfile, using xyz as the filename.
-nolog Disable the logfile (if it's enabled by default).
-putthrottle:nn
-pt:nn
Set the minimum time (in seconds) the bot will wait between saving pages. user-config.py parameter: put_throttle ?
-verbose
-v
Make the program output more detailed messages than usual to the standard output about its current work, or progress, while it is proceeding. This may be helpful when debugging or dealing with unusual situations. not selected
  1. Commons uses 'commons' for lang and family; Meta uses 'meta' for both.
Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox