(→‎replace.py: avoid -start)
(not stub)
Line 62: Line 62:
* [[Botwiki:|Botwiki]] - a wiki for documenting and testing bots, including [[Appropedia:Pywikipedia|Pywikipedia]] and [[Botwiki:Manual:Frameworks|other bots]].
* [[Botwiki:|Botwiki]] - a wiki for documenting and testing bots, including [[Appropedia:Pywikipedia|Pywikipedia]] and [[Botwiki:Manual:Frameworks|other bots]].


{{stub}}


[[Category:Appropedia bots]]
[[Category:Appropedia bots]]

Revision as of 01:28, 25 April 2013

Notes on using the Pywikipediabot (or Pywikipedia) specifically for Appropedia can be placed here.

In the meantime see the quick, simple and basic guide on botwiki. For more detail, see meta:Pywikipedia.

Note that Chriswaterguy is using this bot, so after you've set up, or if you follow the instructions and have problems, you can contact him.

Set up

Follow the instructions linked above to install Pywikipediabot. Then, you need to create the following files in the appropriate places:

Get the site dump

Using the bot works best if you have a recent copy of the "current dump".

Decompress the dump file, currentdump.xml into the bot's root directory, and use the term -xml:currentdump.xml in your bot command. This works in the replace.py script, and several others. (Alternative parameters are -category:'category name' and -start:pagename - avoid start except where doing a few pages all starting with the same string, as it requires downloading each page on the wiki.)

Running the bot

redirect.py is relatively easy, and is a good one to start on.

Chriswaterguy has used the bot with the replace.py script to add categories, add wikilinks, do more straightforward text replacement.

More information can be found at meta:Pywikipedia, but is incomplete and confusing at present.

Help

Help can be found on Pywikipedia-L - IRC is available (#Pywikipedia on freenode) but very quiet, so it's more useful to stick to the lists.

Sample usage

replace.py

 python replace.py -namespace:2 -start:User:Tahnok

This will search through namespace #2 (which is User:). You can change it to a different one by looking it up. You can also specify multiple namespaces with -namespace:2,3.

The -start:PAGENAME indicates where the bot should start. It isn't needed, and a different source should be specified if intending to search all pages in the namespace(s).

As noted above, -xml:currentdump.xml is much more efficient, unless you need a more recent version than is available as a dump, and you are doing a small number of pages (e.g. up to 100 or so) rather than searching a whole namespace. Other options include -cat, -xmlstart, -prefixindex and -titleregex. See meta:Pywikipediabot/replace.py#Local for details.

redirect.py

python redirect.py double

This suggests double redirects to fix.

python redirect.py double -always

This fixes double redirects without asking. This is safe to run regularly on the live site. Check to see that the output makes sense (pages aren't being redirected to other pages that don't make sense). In the unlikely event that there is a problem, go to the wiki and manually revert the particular move.

See also


Interwiki links

Cookies help us deliver our services. By using our services, you agree to our use of cookies.