1 |
{\rtf1\ansi\ansicpg1252\cocoartf2638
|
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 Advice and Commands 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 Bash scripts.\
|
17 |
\
|
18 |
\ul Running a script\ulnone \
|
19 |
See "Read-me.rtf".\
|
20 |
\
|
21 |
\ul Category renaming\ulnone \
|
22 |
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
23 |
|
24 |
\f2\fs24 \cf0 python pwb.py category move -from:"Art by Okita" -to:"Art by Alex Okita"
|
25 |
\f1\fs28 \
|
26 |
\
|
27 |
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
28 |
\cf0 \ul General text replacement\ulnone \
|
29 |
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
30 |
|
31 |
\f2\fs24 \cf0 python pwb.py replace -page:pagetitle "old text" "new text" -summary:"something"
|
32 |
\f1\fs28 \
|
33 |
Use "-simulate" to perform a dry-run.\
|
34 |
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 Bash scripts.\
|
35 |
\
|
36 |
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
37 |
\cf0 \ul Page scope arguments\ulnone \
|
38 |
There are a ton of ways to select pages on which 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.} |