How to Use these Scripts

These are some helpful scripts written for Pywikibot or for the Bash shell.

To run the .py bot scripts, first install Pywikibot.  Then place the .py scripts in the core/scripts/ directory.  Then 'cd' into the core/ directory and run the command "python pwb.py [name of script without the suffix] [arguments for script]".

check_interwiki_links.py
This script scans the wikitext of the supplied page, or all the pages in the supplied category, for interwiki links such as [[wp:Example]] and [[wikt:Definition|some word]].  It then tests those links to make sure they're valid and prints a "WARNING:" message if a redirect or 404 is encountered.

Example usage:
python pwb.py check_interwiki_links -page:"Daodan" (checks a single page)
python pwb.py check_interwiki_links -cat:"Wiki Support" (checks the whole category recursively)

find_external_images.sh
This script scrapes the HTML of the supplied category of pages and alerts the user to external images so he can consider localizing them to the wiki.  Special attention is drawn to images hosted elsewhere on oni2.net.  This script isn't totally finished and the argument-handling code is in a bit of disarray, but in theory it supports optionally showing inline and/or non-embedded external image links, as well as accepting an individual page as an argument.

Example usage:
python pwb.py find_external_images -justshown -cat:"Category:Real World"

drive_https_upgrade.sh
This Bash script was designed to take a TXT report from a Validate External Links session run without the --show-https-upgrades argument and use it to mass-change all the links that wanted an upgrade from HTTP to HTTPS.  In such a report, links that wanted an HTTPS upgrade would have the phrase "http->https" in it, so this is what the script uses regex to search for.  It edits all such links from the one numbered FIX_START to the one numbered FIX_END.  This script served its purpose and probably won't need to be used again, but it has value as a tutorial.

drive_slash_adding.sh
Ditto what I wrote above, except for a ValExtLinks session run without the --show-added-slashes argument.  In this case the word "trailing", as in "trailing slash", is looked for.  Probably won't need to use this again, but it has some instructional value.