| 1 |
{\rtf1\ansi\ansicpg1252\cocoartf2636
|
| 2 |
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fnil\fcharset0 Menlo-Regular;
|
| 3 |
}
|
| 4 |
{\colortbl;\red255\green255\blue255;}
|
| 5 |
{\*\expandedcolortbl;;}
|
| 6 |
\margl1440\margr1440\vieww13260\viewh11840\viewkind0
|
| 7 |
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc\partightenfactor0
|
| 8 |
|
| 9 |
\f0\b\fs28 \cf0 Uses for Pywikibot
|
| 10 |
\f1\b0 \
|
| 11 |
based on https://www.mediawiki.org/wiki/Manual:Pywikibot/Scripts\
|
| 12 |
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
| 13 |
\cf0 \
|
| 14 |
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
| 15 |
\cf0 \ul \ulc0 Throttling a script\ulnone \
|
| 16 |
For safety's sake and to not overload the wiki, you should limit the rate of your API calls. Bot scripts will automatically throttle themselves according to the value of "put_throttle" in user-config.py, but if you are performing an operation by calling a bot script multiple times then you must implement your own external throttle. For working examples, see my .sh scripts.\
|
| 17 |
\
|
| 18 |
\ul Category renaming\ulnone \
|
| 19 |
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
| 20 |
|
| 21 |
\f2\fs24 \cf0 python pwb.py category move -from:"Art by Okita" -to:"Art by Alex Okita"
|
| 22 |
\f1\fs28 \
|
| 23 |
\
|
| 24 |
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
| 25 |
\cf0 \ul General text replacement\ulnone \
|
| 26 |
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
| 27 |
|
| 28 |
\f2\fs24 \cf0 python pwb.py replace -page:pagetitle "old text" "new text" -summary:"something"
|
| 29 |
\f1\fs28 \
|
| 30 |
Use "-simulate" to perform a dry-run.\
|
| 31 |
Add "-always" to save edit without prompting. \ul Not\ulnone using this will allow a -simulate run to show you what changes will actually be made. For working examples of how to use "replace", see my .sh scripts.\
|
| 32 |
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
| 33 |
\cf0 \
|
| 34 |
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
| 35 |
\cf0 \ul \ulc0 Page scope arguments\ulnone \
|
| 36 |
There are a ton of ways to select which pages to run a Pywikibot script on besides specifying a single page with "-page". Not only are there -cat and -catr (all pages recursively under that cat), but also -ns, -grep, -subpage, -titleregex, -wantedpages, -transcludes, -start (proceeds from that point alphabetically), -imagesused (on a given page), -links (to other pages from a given page), -filelinks (image links on given page), and much more. See "Generator and replace options.txt" for details.} |