ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/ValBot/Docs/Pywikibot commands.rtf
Revision: 1195
Committed: Fri Aug 15 20:46:53 2025 UTC (8 weeks ago) by iritscen
Content type: application/rtf
File size: 5758 byte(s)
Log Message:
ValBot: Added instructions for batch page moving.

File Contents

# Content
1 {\rtf1\mac\ansicpg10000\cocoartf\nisusversion50401 {\*\nisusorigapp Cocoa}{\*\nisusorigdate\yr2023\mo12\dy3\hr14\min15 }{\*\nisussysvers 15.4.1}\deff0
2 {\*\fonttbl
3 {\f0\fswiss\fcharset77 Helvetica;}
4 {\f1\fswiss\fcharset77 Helvetica-Bold{\*\falt Helvetica};}
5 {\f2\fmodern\fcharset77 Menlo-Regular{\*\falt Menlo};}}
6 {\colortbl ;}
7 {\*\nisustoctable
8 {\nisustoc\tcf68 {\nisustocname Default TOC}{\*\nisustoctabrep }{\*\nisustocretrep }{\nisustoclevelstyle TOC 1}{\nisustoclevelstyle TOC 2}{\nisustoclevelstyle TOC 3}{\nisustoclevelstyle TOC 4}{\nisustoclevelstyle TOC 5}{\nisustoclevelstyle TOC 6}{\nisustoclevelstyle TOC 7}{\nisustoclevelstyle TOC 8}{\nisustoclevelstyle TOC 9}}\nisusactivetoc68 }
9 {\*\nisusxetable
10 {\nisusxe\xef68 {\nisusxename Default Index}{\nisusxeheaderstyle Index Heading}{\nisusxelevelstyle Index 1}{\nisusxelevelstyle Index 2}{\nisusxelevelstyle Index 3}{\nisusxelevelstyle Index 4}{\nisusxelevelstyle Index 5}{\nisusxelevelstyle Index 6}{\nisusxelevelstyle Index 7}{\nisusxelevelstyle Index 8}{\nisusxelevelstyle Index 9}{\*\fldinst INDEX \\k ". " \\g \endash \\e "\tab " \\l ", " \\f D}}\nisusactivexe68 }
11 {\stylesheet
12 {\s104\snext104 \ltrpar\pardirnatural\ql\widctlpar\sb0\sa0\sl240\slmult1\hyphpar1\li0\lin0\fi0\ri0\rin0 Header;}
13 {\s105\snext105 \ltrpar\pardirnatural\ql\widctlpar\sb0\sa0\sl240\slmult1\hyphpar1\li0\lin0\fi0\ri0\rin0 Footer;}}
14 \defformat {\*\generator Nisus Writer Express 4.4.1 [0504.0104.01]}{\info {\*\nisusgmtoffset -4:00}{\author Admin}{\creatim\yr2021\mo2\dy5\hr17\min6 }{\revtim\yr2025\mo4\dy24\hr12\min10 }}
15 {\*\userprops }\nisusrulerunits0\nisusstatusbar1\nisusareaid1\viewkind4\viewscale100\nisusviewruler1\nisusviewrulerh1\nisusviewrulerv0\nisusviewtoolbar1\nisusviewtooldrawer0\nisusviewtoolswidth0\nisusviewpagenumtype1\nisusviewrulericons0\donotshowcomments1
16 {\*\nisusviewsettings\viewkind4\viewscale100 {\nisusnavsettings {\*\visible 0}{\*\width 160}{\*\isOnRightSide 0}{\*\mode toc}{\*\sort location}}{\nisuscommentsettings {\*\visible 0}{\*\showPane 1}{\*\isOnRightSide 0}{\*\width 180}{\*\titlebarInfo 2}{\*\showTextHighlighting 1}{\*\showGutterIcons 1}}{\nisusrevisionsettings {\*\visible 0}{\*\showPane 1}{\*\isOnRightSide 1}{\*\width 180}{\*\titlebarInfo 4}{\*\showTextHighlighting 1}{\*\showGutterIcons 1}}}
17 {\*\nisusviewsettings\viewkind1\viewscale100 {\nisusnavsettings {\*\visible 0}{\*\width 160}{\*\isOnRightSide 0}{\*\mode toc}{\*\sort location}}{\nisuscommentsettings {\*\visible 0}{\*\showPane 1}{\*\isOnRightSide 0}{\*\width 180}{\*\titlebarInfo 2}{\*\showTextHighlighting 1}{\*\showGutterIcons 1}}{\nisusrevisionsettings {\*\visible 0}{\*\showPane 1}{\*\isOnRightSide 1}{\*\width 180}{\*\titlebarInfo 4}{\*\showTextHighlighting 1}{\*\showGutterIcons 1}}}
18 \nisusareasplitv0
19 {\*\nisuswindow\x128\y132\w613\actualw613\h631 }
20 \nshwinv0\nshwpg1\nisusinlinespell0\nisushyphnone\spltpgpar\nisusselectstart1326\nisusselectlength0\fet2\ftnbj\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\pgnstart1\nocolbal \f0
21 \sectd\endnhere\cols1\ltrsect\colbalsxn0\pgwsxn12240\pghsxn15840\marglsxn1440\margrsxn1440\margtsxn1440\margbsxn1440\guttersxn0\headery720\footery360\pgncont\pgndec\sxnstarts1\sxnrestart\sxndec
22 {\header\plain\pard\s104\ltrpar\pardirnatural\ql\widctlpar\f0\fs28 }
23 {\footer\plain\pard\s105\ltrpar\pardirnatural\ql\widctlpar\f0\fs28 }
24 \deftab720 {\pard\ltrpar\pardirnatural\qc {\f1\fs28\b Advice and Commands for Pywikibot}{\fs28 \par
25 based on https://www.mediawiki.org/wiki/Manual:Pywikibot/Scripts\par }}
26 {\pard\ltrpar\pardirnatural\ql {\fs28 \par
27 {\ul Logging in\par }
28 If the bot isn't logged into the wiki with a designated bot user account, run:\par
29 \f2\fs24 python pwb.py login{\f0\fs28\ul \par
30 \par
31 Throttling a script}\f0\fs28 \par
32 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.\par
33 \par
34 {\ul Running a script}\par
35 {\*\nisusscroll\nisusarea1\xoffset0\yoffset7 }See "Read-me.rtf".\par
36 \par
37 {\ul Category renaming}\par
38 \f2\fs24 python pwb.py category move -from:"Art by Okita" -to:"Art by Alex Okita"\f0\fs28 \par
39 \par
40 {\ul General text replacement}\par
41 \f2\fs24 python pwb.py replace -page:pagetitle "old text" "new text" -summary:"something"\f0\fs28 \par
42 Use "-simulate" to perform a dry-run.\par
43 Add "-always" to save edit without prompting. {\ul Not} 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.\par
44 \par
45 {\ul Batch uploading}\par
46 \f2\fs24 python pwb.py upload -keep -noverify -abortonwarn /folder/with/imgs/ "[[Category:Some image cat]]"\par
47 \par
48 {\f0\fs28\ul Batch renaming (moving)}\f0\fs28 \par
49 \f2\fs24 python pwb.py movepages -noredirect -pairsfile:/full/path/to/name_changes.txt\par
50 \f0\fs28 The .txt file must{\nisusselectcaret }contain a series of lines like so:\par
51 \fs24 [[frompage1]]\par
52 [[topage1]]\par
53 [[frompage2]]\par
54 [[topage2]]\fs28 \par
55 \par
56 {\ul Page scope arguments}\par
57 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.\par }}
58 }