--- ValBot/Docs/Pywikibot commands.rtf 2022/02/21 23:59:20 1169 +++ ValBot/Docs/Pywikibot commands.rtf 2023/12/03 19:19:11 1187 @@ -1,36 +1,50 @@ -{\rtf1\ansi\ansicpg1252\cocoartf2636 -\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fnil\fcharset0 Menlo-Regular; -} -{\colortbl;\red255\green255\blue255;} -{\*\expandedcolortbl;;} -\margl1440\margr1440\vieww13260\viewh11840\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc\partightenfactor0 - -\f0\b\fs28 \cf0 Uses for Pywikibot -\f1\b0 \ -based on https://www.mediawiki.org/wiki/Manual:Pywikibot/Scripts\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 -\cf0 \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 -\cf0 \ul \ulc0 Throttling a script\ulnone \ -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.\ -\ -\ul Category renaming\ulnone \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 - -\f2\fs24 \cf0 python pwb.py category move -from:"Art by Okita" -to:"Art by Alex Okita" -\f1\fs28 \ -\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 -\cf0 \ul General text replacement\ulnone \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 - -\f2\fs24 \cf0 python pwb.py replace -page:pagetitle "old text" "new text" -summary:"something" -\f1\fs28 \ -Use "-simulate" to perform a dry-run.\ -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.\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 -\cf0 \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 -\cf0 \ul \ulc0 Page scope arguments\ulnone \ -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.} \ No newline at end of file +{\rtf1\mac\ansicpg10000\cocoartf\nisusversion50300 {\*\nisusorigapp Cocoa}{\*\nisusorigdate\yr2023\mo12\dy3\hr14\min15 }{\*\nisussysvers 14.1.2}\deff0 +{\*\fonttbl +{\f0\fswiss\fcharset77 Helvetica;} +{\f1\fswiss\fcharset77 Helvetica-Bold{\*\falt Helvetica};} +{\f2\fmodern\fcharset77 Menlo-Regular{\*\falt Menlo};}} +{\colortbl ;} +{\*\nisustoctable +{\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 } +{\*\nisusxetable +{\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 } +{\stylesheet +{\s104\snext104 \ltrpar\pardirnatural\ql\widctlpar\sb0\sa0\sl240\slmult1\hyphpar1\li0\lin0\fi0\ri0\rin0 Header;} +{\s105\snext105 \ltrpar\pardirnatural\ql\widctlpar\sb0\sa0\sl240\slmult1\hyphpar1\li0\lin0\fi0\ri0\rin0 Footer;}} +\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 }} +{\*\userprops }\nisusrulerunits0\nisusstatusbar1\nisusareaid1\viewkind4\viewscale100\nisusviewruler1\nisusviewrulerh1\nisusviewrulerv0\nisusviewtoolbar1\nisusviewtooldrawer0\nisusviewtoolswidth0\nisusviewpagenumtype1\nisusviewrulericons0\donotshowcomments1 +{\*\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}}} +{\*\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}}} +\nisusareasplitv0 +{\*\nisuswindow\x128\y132\w613\actualw613\h631 } +\nshwinv0\nshwpg1\nisusinlinespell0\nisushyphnone\spltpgpar\nisusselectstart1204\nisusselectlength0\fet2\ftnbj\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\pgnstart1\nocolbal \f0 +\sectd\endnhere\cols1\ltrsect\colbalsxn0\pgwsxn12240\pghsxn15840\marglsxn1440\margrsxn1440\margtsxn1440\margbsxn1440\guttersxn0\headery720\footery360\pgncont\pgndec\sxnstarts1\sxnrestart\sxndec +{\header\plain\pard\s104\ltrpar\pardirnatural\ql\widctlpar\f0\fs28 } +{\footer\plain\pard\s105\ltrpar\pardirnatural\ql\widctlpar\f0\fs28 } +\deftab720 {\*\nisusscroll\nisusarea1\xoffset0\yoffset2 }{\pard\ltrpar\pardirnatural\qc {\f1\fs28\b Advice and Commands for Pywikibot}{\fs28 \par +based on https://www.mediawiki.org/wiki/Manual:Pywikibot/Scripts\par }} +{\pard\ltrpar\pardirnatural\ql {\fs28 \par +{\ul Logging in\par } +If the bot isn't logged into the wiki with a designated bot user account, run:\par +\f2\fs24 python pwb.py login{\f0\fs28\ul \par +\par +Throttling a script}\f0\fs28 \par +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 +\par +{\ul Running a script}\par +See "Read-me.rtf".\par +\par +{\ul Category renaming}\par +{\f2\fs24 python pwb.py category move -from:"Art by Okita" -to:"Art by Alex Okita"}\par +\par +{\ul General text replacement}\par +{\f2\fs24 python pwb.py replace -page:pagetitle "old text" "new text" -summary:"something"}\par +Use "-simulate" to perform a dry-run.\par +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 +\par +{\ul Batch uploading}\par +\f2\fs24 python pwb.py upload -keep -noverify -abortonwarn /folder/with/imgs/ "[[Category:Some image cat]]"{\f0\fs28\nisusselectcaret \par } +\f0\fs28 \par +{\ul Page scope arguments}\par +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 }} +} \ No newline at end of file