Entertainment
 
[Sikon]

Sikon 12,720 edits since June 26, 2005

12,720

User:Sikon/Pywikipedia

From Wookieepedia, the Star Wars wiki.

To configure the Pywikipedia bot toolkit:

  • Install Python version >=2.3. (python.org)
  • Download the latest CVS snapshot (I prepackaged it at http://lucidfox.org/dump/snapshot.tar.bz2)
  • Create a file called user-config.py in the root directory (where the config.py file resides) and insert:
import os, re, sys
family = 'starwars'
mylang = 'en'
usernames['starwars']['en'] = 'bot username'
minthrottle = 1
maxthrottle = 4
put_throttle = 4
noisysleep = 2.0

The throttle values regulate how long the bot will wait between getting and saving pages.

  • Create a file called starwars_family.py in the families directory with the following content:
import family
   
class Family(family.Family):
   def __init__(self):
       family.Family.__init__(self)
       self.name = 'starwars'
   
       self.langs = {
           'en': None,
           }
   
       # Most namespaces are inherited from family.Family.
       self.namespaces[4] = {
           '_default': u'Wookieepedia',
       }
       self.namespaces[5] = {
           '_default': u'Wookieepedia talk',
       }
       
       # A few selected big languages for things that we do not want to loop over
       # all languages. This is only needed by the titletranslate.py module, so
       # if you carefully avoid the options, you could get away without these
       # for another wiki family.
       self.languages_by_size = ['en']
   def hostname(self,code):
       return 'starwars.wikia.com'
   def path(self, code):
       return '/index.php'
   def version(self, code):
       return "1.9"
  • Now try running some scripts. A summary on command line options is present in the .py files themselves.

Some example commands used by R2-D2 so far:

  • implementing auto-hiding in planet infoboxes by removing the "Unknown" text (repeated for "Core planets", "Colonies planets", "Tapani Sector planets" and "Planets"):
python replace.py -cat:Core_planets "=Unknown" "="
  • moving categories (category names were input at prompt):
python category.py move
  • fixing template categories with a modified version of catall.py (with the noinclude notation support).
  • gender categorization
echo a|python replace.py -ref:Template:Character_infobox -regex "gender=([^M]*)Male([^}]*)}}" "gender=\\1Male\\2}}">/dev/null

(output was disabled to save my bandwidth)