Community Central


An introduction to Pywikipediabot

Nuvola apps important This article may contain out of date images or incorrect information!
  • Please help out!

This blog is now old and outdated. I don't recommend it as a good starting guide to pybot. Unfortunatly I don't have the time at the moment to sit down and make a new one. Sorry about that

This guide hopes to be an easy-to-use introduction to the use of pywikipediabot on Wikia. If I've missed something, or something needs correcting - let me know and I'll update the post.

Credits to: RansomTime and Jr Mime.

What is Pywikipediabot?

Pywikipedia bot is a set of powerful wiki tools written in Python for performing automated tasks on wikis. It's ran on a command line interface, which seems a lot harder to use for the newcomer than AutoWikiBrowser, but it can do a lot of things that AWB cannot, and the command line interface makes it faster once you're familiar with how it works.

Setting up the bot

Firstly, you'll need another account on Wikia to act as a bot account. Staff can flag this with a bot flag after you have discussed this with your community (typically on a forum or blog post). A bot flag allows bot edits to be hidden from RecentChanges. Use Special:Contact on your wiki to request a bot flag after your community has discussed this.



If you're running Mac or Linux, Python should be pre-installed, so you can skip this step. Windows users should go to and download and install the latest python with the version number starting with 2 (at the time of writing this is 2.7.3). Warning: Pywikipediabot does not support python version 3 - do not use it, and (unless you need it for something else) don't install it.

Downloading pywikipediabot

Download from the link (here and find the zip file if that didn't work) and extract somewhere sensible (I extracted mine at C:\Pybot).

Technically minded folks might prefer to download the bot via git, if you don't know what this means, I'd recommend getting the .zip, it will work just fine.
git clone --recursive

Installing Notepad++ (optional)

Although not required, Notepad++ is a free text editor that offers regex find and replace and syntax highlighting which can be a godsend when trying to get a list of pages to delete. Download it here. When editing text that the bot will be working on, set the encoding to UTF-8 on Notepad++, you can do this in the Encoding menu at the top.

Generating family and user files

  1. Launch a command line.
    PybotTT Gen Family running on windows

    • Windows users should press start, click run and type "cmd" and press enter.
    • Mac Users, it's apparently in /Applications/Utilities/ - and called Terminal.
    • Linux users press alt+f2 and type the name of their favorite terminal emulator (for example "xterm").
  2. Change the directory in the command line to the directory that you extracted
    • On windows, the command is cd, so if you extracted the file to C:\Pybot, then type cd C:\Pybot. The text before the > on the command line should change to that directory.
    • On mac and linux, the command is also cd, File paths are different in Linux, windows uses the \ for file paths, whilst Linux and mac use /.
  3. Once you're in the Pywikipediabot directory, run the script
    • In windows, simply type (windows associates the file type .py with python if you installed python correctly). Mac and linux users should type "python". If you press the tab key after typing a few letters the terminal should automatically fill out the rest of the file name. Once you've started the script, follow the instructions.
    • If you're switching wikis, you'll need to generate a family file for each wiki you want to edit, but there's no need to do this now.
    • Feel free to say "no" to the question "Do you want to generate interwiki links?" - you're only going to be working on your local language version of the wiki.
  4. Then run the script - choose option 1 then type the number in the list corresponding to the family file you just generated. In the username field, give the name of your bot account.

Adding an admin account (optional) and logging in

If you want to add an admin account (only admins can delete pages), you'll need to edit your with a text editor, you can find it in your pywikipediabot directory. Open it in Notepad++. You should see a file similar to this:
# -*- coding: utf-8  -*-
family = 'community'
mylang = 'en'
usernames['community']['en'] = u'Team_Nimrod'
If you wanted to add an admin account to this file, add a line below called sysopnames with the same syntax as the usernames line, i.e.
sysopnames['community']['en'] = u'RansomTime'

Note that Usernames and sysopnames can be the same name, if you gave your bot account admin rights. If you do this, remember that those admin actions will be hidden from Recent Changes if the bot has a bot flag.

Now we're ready to test the bot to see if it works. Go back to your command line and run
enter the password for your bot account, the script should return
Logging in to community:en as Team_Nimrod via API.
Should be logged in now

Changing wikis

If you ever want to change the wiki your bot is working on, run for the new wiki and then edit to change the family for the old wiki for the new. I.e., if I wanted to change the above file for the call of duty wiki (I called the call of duty wiki's family file "cod"):
# -*- coding: utf-8  -*-
family = 'cod'
mylang = 'en'
usernames['cod']['en'] = u'Team_Nimrod'
sysopnames['cod']['en'] = u'RansomTime'

Multiple wikis

If you want pybot to work on multiple wikis without creating a lot of pywikipediabot folders, you can change them with a simple code.

First, you will need to create family files for all of the wikis. Then, you will need to change the as follows (family files can change):
# -*- coding: utf-8 -*-
family = 'cod'
mylang = 'en'
## Call of Duty Wiki ##
usernames['cod']['en'] = u'Team_Nimrod'
sysopnames['cod']['en'] = u'Team_Nimrod'
## Community Central ##
usernames['cc']['en'] = u'Team_Nimrod'
sysopnames['cc']['en'] = u'Team_Nimrod'

There is no limit on how many family files you can have.

To run different families, you will need to follow these steps:

  1. Login into pybot by using -all -pass, this will ask what is the password for all accounts.
  2. To change between families, use -family:Name (Example: -family:cod) with the scripts you are running (like

Now what?

Now you've set up the bot, you shouldn't need to touch many of the configuration files again. Pywikipediabot contains a lot of different scripts that can do various tasks on your wiki - you'll have to find the right tool for the job and read up on how to use it. There are plenty of examples on the manual pages at

As an example of what you can do, I'm going to run you through using to rename a category on my test wiki. I'm going to be moving Category:Call of Duty 3 Achievements to Category:Cod 3 Achievements.

  1. Firstly, I go to the page on the manual, and I read up on how works.
  2. The manual says that the command I need is " move". I type that into the command line.
  3. I receive the output: Please enter the old name of the category: and Please enter the old name of new category:, and fill it in.
  4. The bot works on it, tells me if there are any errors, and finishes.
Updating page [[Assault Trooper]] via API
Updating page [[Basic Training (Call of Duty 3)]] via API
Updating page [[Battlefield Scavenger]] via API
Updating page [[Big Air]] via API
Updating page [[Canadian Highlander]] via API
Updating page [[Polish Tanker]] via API
Updating page [[Purple Heart (Call of Duty 3)]] via API
Updating page [[Rifleman (Call of Duty 3)]] via API
Updating page [[Supply Officer]] via API
Getting [[Category:Call of Duty 3 Achievements]] list...

The category is now empty, it's moved. The bot's task is done. Simples.

If you have any questions, feel free to ask me in the comments.

Batch files

Batch files, or .bat files, are files that, when clicked, will open the CMD and run the command within it.


Batch files are useful to clean red links, wanted categories or your daily double/broken redirect fixer. Here is an example to clean double/broken redirects from a .bat file:

First, you will have to create a .bat file.

  1. Make a new text document
  2. Change the ending (which is .txt) to .bat

Now, right click the file and click Edit. This will open the normal Notepad.

To clean double/broken redirects, you will need to use

In the .bat file, you will type this: both -always -api

Save the file. This will remove double AND broken redirects

If you want it to only clean double redirets, command will be: double -always

If you want it to delete broken redirects, command will be: broken -always

To be able to fix double/broken redirects on multiple wikis, you will need to use the original coding (when creating the .bat file), and add these:

After the first line, a '&' will tell the .bat file to run the command after the first one is finished. You will need to add -family:(name)So, you will add this: both -always -api & both -always -api -family:cc

After you have customized your batch file, you can save it and double click it. Make sure you are logged in.

It will run into CMD, and clean double and broken redirects! After that it is done, it will close automatically.

Also on Fandom

Random Wiki