Pybot Wiki
Register
Advertisement
This page will INTRODUCE you to a basic topic.

A pywikipediabot, or pybot for short, is a bot powered by pywikipedia scripts built to aid in the maintenance of wikis. Its name refers to python, the programming language on which the bot runs; wikipedia, the wiki for which pybot scripts were initially written; and bot, the program or account that performs the automated tasks. The name has sometimes been shortened to simply pywikibot due to its use on non-Wikipedia wikis.[1] Pybots can be run on any wiki run with MediaWiki software, including Wikia wikis.

Once pywikipedia is installed as is python, and you are logged in to your bot's account, pybot is run in Command Line, where the following format is used:

C:\pywikipedia>python script.py -parameters

If you use a computer run on UNIX — like OS X or Linux — it might look more like this:

$ cd pywikipedia
$ python script.py -parameters

Note that if you are running the core version of pywikibot rather than compat, you will have to access scripts via pwb.py from the core folder, for example:

python pwb.py categories add

would be the equivalent of the compat version's

python category.py add

For most scripts, it will then show you a proposed change and ask for your approval. Pybot can be run in either manual mode — where you must approve each and every edit or change — or automatic — where the bot does its task in every possible place as defined by the parameters. It's not recommended that a bot be run on automatic until you are absolutely sure it's doing what you want it to be doing with no exceptions.

Pywikipediabot has a wide range of scripts available. These serve multiple functions, from simply adding text in the form of add_text.py, to maintaining categories with category.py, to importing a load of images from another wiki using imageharvest.py, to performing admistrative duties like deleting (delete.py), protecting (protect.py) or archiving (archivebot.py). Some only work on Wikipedia, some don't work at all, and some — like family files or login.py — only serve to keep pybot going. An incomplete collection of scripts can be found at our Script Library.

While scripts tell the bot what kind of operation it's running, parameters give it the specifics. This can range from global parameters like -user -family and -pt, which run on most or all scripts, to recurring params like -ref or -cat, to more specialised ones like -uncatfiles, which runs on very few scripts. Parameters are mainly split up into those that delimit or specify the selection like -start, -titleregex or -exceptinside, and those which tell the bot how to run a command, like -always or -regex. A list of available parameters is at your disposal at our Parameter Stockhouse.

Also useful in many scripts is regex, or regular expressions. This is a language usually — though not always — used for search patterns. It is the default for certain parameters — usually those with "regex" or "regexp" in their names — and can be activated for certain others through the use of the -regex parameter. You can learn all about the language and see some example strings at our Regex Repository.

While most commands are typed in directly to Command Line, you'd sometimes be better off putting longer ones in files in the pywikipedia folder. For replace.py, this comes in the form of user-fixes, while pagefromfile.py, for instance, uses text files. For examples of user-fixes, see our Fix Files collection.


Begin your journey by clicking on one of the buttons below:

Scripts-button
Parameters-button
Regex-button
Fixes-button
Scripts Parameters Regex Fixes

References[]

Advertisement