Manual talk:Pywikibot/add text.py

From MediaWiki.org
Jump to navigation Jump to search
The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).

Add Text to pages in Special:WantedCategories[edit]

The header says it all... Is it possible to add a specific text to all pages in Special:WantedCategories? --91.33.247.68 21:23, 23 September 2009 (UTC) (Felix)

You can use the cat parameter, multiple times, e.g.
add_text.py -cat:"WandetCat1" -cat:"WantedCat2" -text:"Text to be added"
but I don't know any way to refer on Special:WantedCategories or on any special page. --Plasmarelais 17:37, 29 September 2009 (UTC)

Bot doesn`t see the article[edit]

Hello!

I got some troubles while using this bot on my own wiki-site. It starts normally, gets the category. Then following message comes:

Note: this language does not allow global bots.
Loading %pagename%...
Getting page [[%pagename%]]
Request ru:/wiki/api.php?action=query&format=json&meta=userinfo&uiprop=blockinfo
Note: this language does not allow global bots.
%pagename% doesn't exist, skip!
Traceback (most recent call last):
  File "%path%/pywikipedia/add_text.py", line 312, in <module>
    main()
  File "%path%/pywikipedia/add_text.py", line 308, in main
    (text, newtext, always) = add_text(page, addText, summary, regexSkip, regexSkipUrl, always, up, True)
ValueError: need more than 2 values to unpack


%pagename%, %path% - i put it here instead of real names. May be I should "turn on" global bots on my wiki somehow? I have mediawiki 1.15.1, python 2.6.2, pywikipedia 7282 installed. I`ll be glad to get any help, `cause this is first time I use pywikipedia bots. 93.89.211.151 13:36, 24 September 2009 (UTC)

Is your bot running with global bot rights or with local bot rights? --Plasmarelais 17:50, 29 September 2009 (UTC)
Plasmarelais, thank you for attention. I can`t tell you such info, just because I don`t know, how to check it. Could you explain more properly what file I can get such info from?
It seems I didn't find out, what is meant with global bot. You say it's your own wiki, is it a wikia-wiki? Maybe these 2 pages may help, but I don't know more about it: m:Talk:Bot policy/Implementation and m:Bot policy#Global bots. Sorry --Plasmarelais 12:37, 5 October 2009 (UTC)
Thank you for trying to help. I`ve looked through these pages, but I still can`t understand, how do I turn these global bots on and do I realy need it to be done to solve my problem...--91.193.253.138 13:29, 5 October 2009 (UTC)
Updating to the 7492-version of pywikipedia fixes the problem.--91.193.253.138 21:52, 17 October 2009 (UTC)

Add text to empty pages[edit]

I've got a problem. I want to add a (long) text to ~150 pages. I've got a List of all these pages. Unfortunately it doesn't work.

Here is what I've tried so far (Do not punch me. The error logs prooves that I'm using windows -- and german...):

C:\Users\damrau\Miniprogs\pywikipedia>python add_text.py -links:Spielwiese -text:"Test"
Loading Benutzer Diskussion:-MM-...
Benutzer Diskussion:-MM- doesn't exist, skip!
Traceback (most recent call last):
 File "add_text.py", line 312, in <module>
   main()
 File "add_text.py", line 308, in main
   (text, newtext, always) = add_text(page, addText, summary, regexSkip, regexS
kipUrl, always, up, True)
ValueError: need more than 2 values to unpack

Does anybody know how to solve this? I do not really understand the error message. --91.33.195.178 08:02, 5 October 2009 (UTC) (Felix)

Far as I know, add_text.py only works on existing pages. But you may use Pywikipediabot/pagefromfile.py to create those pages using a file that contains necessary information, which should easily be created from the list you already have. --Plasmarelais 08:13, 5 October 2009 (UTC)
Excuse my offtop. As I see, this problem is quite similar to the one I`ve got (see the previous topic). But in my situation I do have this pages on my wiki, but add_text.py doesn`t see them. Any idea about this? (Please, answer in previous topic).--91.193.253.138 11:15, 5 October 2009 (UTC)
There is a quite new version of this script. Did you download and replace this with the file in your pywikipedia directory? Maybe that will solve your problem --91.33.195.178 22:30, 5 October 2009 (UTC) (Felix)
There is an easy way to make add-text.py not skip non-existent pages. Simply edit the add_text.py file to change "create=talkPage" (sixth line from the bottom) to "create=True". 71.232.44.22 19:21, 24 May 2012 (UTC)

No documented parameters[edit]

The readme/docs for this script do not include or state the core parameters that can be used. Currently it only says:

These command line parameters can be used to specify which pages to work on:
  &params;

So my question is... what parameters? --Ccornell 09:08, 20 November 2009 (UTC)

&params will work nicely, when you type add_text.py -help. It takes help from pagegenerators.py. Bináris tell me 11:58, 4 March 2011 (UTC)

Why is this page moved to mw?[edit]

What was the reason to move this page from Meta to MediaWiki, while all the similar pages about various scripts are on Meta? Bináris tell me 12:00, 4 March 2011 (UTC)

Merged content[edit]

This section, without the section header and the italic comments was here on mw.org before the import of the above content from meta
What was the reason to move this page from Meta to here, while all the similar pages about various scripts are on Meta? Bináris 11:55, 4 March 2011 (UTC)

I didn't find the consensus but suggest to build the JavaScript library at the same place. JackPotte 10:06, 5 March 2011 (UTC)

This stuff is not related to JavaScript, and now it is disconnected from other Pywikibot scripts. Bináris 21:18, 16 March 2011 (UTC)

End merged content
The above thread refers to the import of the add_text.py documentation when most other pages had not been imported. Now all pywikipediabot documentation and talk pages have been imported. The reason for the move is that the pywikipediabot scripts are maintained in the wikimedia subversion repository and therefore documentation for them belongs here on mw.org--Doug.(talk contribs) 21:17, 18 December 2011 (UTC)

Problems with large pages (> 600 kB)[edit]

Is it possible that this script doesn't work with large pages of e.g. more than 600 kB? I got a Python error when I tried to add some sections to [1], but with a similar page of about 350 kB it worked perfectly. I don't know if this is a known issue or if I have to file a bug. Regards --CroMagnon (talk) 22:42, 17 November 2012 (UTC)

Sections[edit]

How can I add text for a section? (by name, by the number of the section) Thanks, Dekel E (talk) 07:19, 3 January 2014 (UTC)

parameter except[edit]

Do I get it right, that whenever i give more than one parameter except, that the script only skips those pages that contain all of the given strings? Example:
add_text.py -start:! -text:"TEXT" -except:"abc" -except:"xyz"
will add text on a page that contains abc but not xyz (and vice versa) but will skip a page that contains abc and xyz? --Plasmarelais (talk) 09:10, 12 August 2015 (UTC)

Solution: Using the pipe in the except parameter. -except:"(\[\[[Cc]ategory)|([Ll]icense)|(\{\{[Ss]ource)" will have the bot skip any page that contains Category or category or License or license or... --Plasmarelais (talk) 21:10, 29 August 2015 (UTC)

Allow to remove minor edit tag[edit]

Hello,

I use the script to add a section to a project page which is designed for technical logs (essentially added by bots). But, with this script, I currently can't remove the minor edit tag, which is fixed automatically. Could we add a parameter to add_text(…) to allow the removal of this tag? — Automatik (talk) 16:39, 6 March 2016 (UTC)