User:Inductiveload/InductiveBot information

InductiveBot is based on pywikipedia, and a few scripts that run over pywikipedia, performing more complex edits that cannot be done simply with the out-of-box scripts.

Generally I call my scripts "aa-xxxxx.py", so they float to the top of list of files. Text input files I call "ab-xxxx.txt".

Handler scripts
One class of script I have found to be very useful is the "handler script" which is a script which calls a pywikipedia script in turn. This means that for common operations, you don't have to type in a complex command line argument list, just load up the script from last time, change relevant parameters and away you go.

A useful pair of functions for Page: namespace
The following functions decompose a page in the Page: namespace consisting of a header, body, and footer, and then recompose them neatly after modification. The noincludes around the header and footer must be well formed, or the Javascript that presents them in the edit page with break.

vorbis=1
Original replacement: python pwb.py replace -search:"insource:/vorbis=\"?1\"?/" '[^%]vorbis="1"' "%vorbis=\"1\"%%T257066%" -summary:"Comment out vorbis=1 while T257066 (score extension disabled) is resolved." -namespace:0

Inverse: python pwb.py replace -search:"insource:/vorbis=\"?1\"?/" "%vorbis=\"1\"%%T257066%" 'vorbis="1"'