{\rtf1\ansi\ansicpg1252\cocoartf2636 \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fswiss\fcharset0 Helvetica-Oblique; } {\colortbl;\red255\green255\blue255;} {\*\expandedcolortbl;;} \margl1440\margr1440\vieww13140\viewh14100\viewkind0 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc\partightenfactor0 \f0\b\fs28 \cf0 How to Use these Scripts\ by iritscen@yahoo.com \f1\b0 \ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 \ In the course of maintaining the OniGalore wiki, I have written some Python and Bash shell scripts for Pywikibot. My Bash shell scripts call existing Python scripts which come with Pywikibot. My Python scripts utilize the Pywikibot API to perform new tasks not covered by the bundled scripts. To run the scripts, first {\field{\*\fldinst{HYPERLINK "https://www.mediawiki.org/wiki/Manual:Pywikibot/Installation"}}{\fldrslt install Pywikibot}}, then read below.\ \ \ul Python\ulnone \ In Terminal, 'cd' into the core/ directory and run the command "python pwb.py /path/to/script [arguments for script]". When running a built-in Pywikibot script, you would simply invoke it with "python pwb.py [name of script without suffix] [arguments]", but since these scripts are outside the core/ directory they need full pathname qualification.\ \ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \f0\b \cf0 check_interwiki_links.py \f1\b0 \ 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.\ \ 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)\ \ \f0\b check_intrawiki_section_links.py \f1\b0 \ This script scans the wikitext of the supplied page, or all the pages in the supplied category, for intrawiki links with section links in them such as [[Konoko#In-game_appearance]]. It then tests those links to make sure they're valid and prints a "WARNING:" or "ERROR:" message if a problem is encountered. "ADVICE:" messages are printed when a link cannot be tested because transclusion is being used to construct it dynamically.\ \ Usage: The syntax is the same as for check_interwiki_links.py.\ \ \f0\b find_external_images.py \f1\b0 \ This script scrapes the HTML of the supplied category's pages and alerts you to externally-linked images so you can consider uploading 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 it should support showing inline and/or non-embedded external image links.\ \ Usage:\ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 python pwb.py find_external_images -page:"State of Emergency"\ python pwb.py find_external_images -justshown -cat:"Category:Real World"\ \ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \f0\b \cf0 uncapitalize_image_suffixes.py \f1\b0 \ This script checks all the images on the wiki for capitalized file suffixes (.JPG instead of .jpg, etc.) and renames them to be non-capitalized. Note that any pages linking to the images will need to be corrected manually afterward, but the script will tell you which pages link to or embed each image that it renames.\ \ \ul Bash\ulnone \ \f0\b drive_https_upgrade.sh \f1\b0 \ This script was designed to take a TXT report from a Validate External Links session run \ul without\ulnone the --show-https-upgrades argument and use it to mass-change all the URLs for sites that wanted an upgrade from HTTP to HTTPS. In such a TXT report, links which wanted an HTTPS upgrade would have the phrase "Skipping URL \f2\i x \f1\i0 because I have not been asked to show http->https upgrades" in it, so the script uses regex to search for "http->https". 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 be needed again, but it has value as a tutorial.\ \ \f0\b drive_slash_adding.sh \f1\b0 \ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 This script was designed to take a TXT report from a Validate External Links session run \ul without\ulnone the --show-added-slashes argument and use it to mass-change all the URLs that wanted a trailing slash added to them. In such a TXT report, URLs where the server asked for a trailing '/' to be added to the URL would have the phrase "Skipping URL \f2\i x \f1\i0 because I have not been asked to show added trailing slashes", so the script searches for the word "trailing". This script served its purpose and probably won't be needed again, but it has value as a tutorial.\ \ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 \ul Docs\ \f0\b \ulnone Generator and replace options.txt \f1\b0 \ul \ \ulnone This is the help text generated by "python pwb.py replace -help". It shows the many options you have for using the built-in replace.py script and for asking any built-in Pywikibot script to limit its scope to certain pages.\ul \ \ulnone \ \f0\b Pywikibot commands.rtf \f1\b0 \ General advice on how to use Pywikibot properly.\ \ \f0\b Read-me.rtf \f1\b0 \ You are here.}