| 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.} |
| 1 |
> |
{\rtf1\mac\ansicpg10000\cocoartf\nisusversion50300 {\*\nisusorigapp Cocoa}{\*\nisusorigdate\yr2023\mo12\dy3\hr14\min15 }{\*\nisussysvers 14.1.2}\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.3 [0503.0004.01]}{\info {\*\nisusgmtoffset -5:00}{\author Admin}{\creatim\yr2021\mo2\dy5\hr17\min6 }{\revtim\yr2023\mo12\dy3\hr14\min16 }} |
| 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\nisusselectstart1204\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 {\*\nisusscroll\nisusarea1\xoffset0\yoffset2 }{\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 |
> |
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"}\par |
| 39 |
> |
\par |
| 40 |
> |
{\ul General text replacement}\par |
| 41 |
> |
{\f2\fs24 python pwb.py replace -page:pagetitle "old text" "new text" -summary:"something"}\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]]"{\f0\fs28\nisusselectcaret \par } |
| 47 |
> |
\f0\fs28 \par |
| 48 |
> |
{\ul Page scope arguments}\par |
| 49 |
> |
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 }} |
| 50 |
> |
} |