User:CzechOut/Bot tricks

The following are a list of tricks I've learned while using pywikipedia.

add_text.py
One of the harder things to do with bots is to work on pages that have no categories. This is because bots depend upon categories for many of their functions. However, bots can be used on pages without categories, as long as you go about things creatively.

If you have a user who is constantly uploading pictures without licenses, it may be easiest just to look for their work, to the exclusion of other people. Here's a run that'll look for only their additions to the file namespace: python add_text.py -text:"" -namespace:6 -usercontribs:"Doctor Who 63" -except:"\{\{[Bb]bcvidcover"

Note that this goes through all their work in namespace 6. So it doesn't look at only their unlicensed work in that namespace. Note that the parameter -uncatfiles doesn't actually help, here. It doesn't hurt, but it doesn't actually confine the search to just those things in namespace 6 modified by Doctor Who 63 which are also uncategorised.

However, -uncatfiles is helpful if you don't have that many files to look after. This is what you use if you just want to add bbcvidcover to pages that aren't categorised. python add_text.py -text:"" -uncatfiles Course, this is a slow way to go about things, because you probably won't want to add a single template to all the uncategorised files. If you want to filter things a bit, you can instead try to find patterns in the titles of the uncategorised files. -titleregex: allows you to make up your own matching rules. But if you can see a quick and dirty pattern at the beginning of a filename, you might try this instead: -prefixindex:"File: " This method is perfect for quickly licensing achievements badges, because they ll start with the term "File:badge".