Jump to content

Manual talk:Pywikibot/Scripts

Add topic
From mediawiki.org
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).

Hierarchy of script description pages

[edit]

Any objection to putting the script description pages under Pywikipediabot/Scripts/ instead of directly under Pywikipediabot/? I think it would be more intuitive, especially with the automatic breadcrumb trail ("< Pywikipediabot < Scripts"). —LarryGilbert 18:25, 8 January 2010 (UTC)Reply

Hmm, I can see a certain logic behind doing it either way. Notice that on MediaWiki.org, we have mw:Manual:$wgTitle rather than mw:Manual:Globals/$wgTitle, but on the other hand we have mw:Manual:Hooks/ArticleSaveComplete rather than mw:Manual:ArticleSaveComplete. Because each script file ends in .py (much as the globals start with $), those pages' purpose is probably self-evident, and therefore we can leave them where they are. Tisane 21:54, 26 April 2010 (UTC)Reply

What's the deal with the commented out stuff?

[edit]

Are those scripts that it would be inadvisable to use? Tisane 22:06, 8 April 2010 (UTC)Reply

Just missing from the list, now should be ok. --Dvorapa (talk) 13:05, 18 November 2018 (UTC)Reply

Uploadmultiple.py

[edit]

Shouldn't this script be taken off the page? It's not included in the framework as its page says. And anyway it's not working. --Plasmarelais 10:19, 3 April 2011 (UTC)Reply

Moreover, Commonist is enough when we know the files names. JackPotte 10:23, 3 April 2011 (UTC)Reply
I never seen that script. I removed it now. Xqt (talk) 17:30, 23 April 2012 (UTC)Reply

Pageimport.py

[edit]

The documentation of this script isn't here, and doesn't work on Wikibooks:

This is a script to import pages from a certain wiki to another.

This requires administrator privileges.

Here there is an example of how to use it:

from pageimport import *
def main():
    # Defing what page to load..
    pagetoload = 'Apple'
    site = wikipedia.getSite()
    importerbot = Importer(site) # Inizializing
    importerbot.Import(pagetoload, prompt = True)
try:
    main()
finally:
    wikipedia.stopme()

When I try it to import an existing page from en.b to fr.b, this script (without project=) writes "success" but does nothing:

from wikipedia import *
from pageimport import *
def main():
    # Defing what page to load..
    pagetoload = 'en:Ict@innovation: Free your IT Business in Africa/fr/1'
    site = wikipedia.getSite(u'fr',u'wikibooks')
    importerbot = Importer(site) # Inizializing
    importerbot.Import(pagetoload, prompt = True)
try:
    main()
finally:
    wikipedia.stopme()

And this one (with project=) returns "failed":

from wikipedia import *
from pageimport import *
def main():
    # Defing what page to load..
    pagetoload = 'Ict@innovation: Free your IT Business in Africa/fr/1'
    site = wikipedia.getSite(u'fr',u'wikibooks')
    importerbot = Importer(site) # Inizializing
    importerbot.Import(pagetoload, prompt = True, project = u'en')
try:
    main()
finally:
    wikipedia.stopme()

JackPotte (talk) 14:16, 4 November 2012 (UTC)Reply

Missing compat scripts

[edit]

ToDo list

  • blockreview
  • catimages
  • checkimages
  • create_categories
  • disambredir
  • imagecopy_self
  • interwiki_graph
  • ndashredir
  • nowcommons
  • overcat_simple_filter
  • pageimport
  • parserfunctioncount
  • patrol
  • spamremove
  • spellcheck
  • splitwarning
  • standardize_notes
  • subster
  • subster_irc
  • sum_disc
  • tag_nowcommons
  • unusedfiles

Hello world?

[edit]

Is there a "Hello world!" script?

I cooked one and it worked:

import pywikibot

site = pywikibot.Site()
page = pywikibot.Page(site, u"Sandbox")
text = page.text

page.text = u"Hello world!"
page.save(u"My bot's first edit!")

The above replaces the text of the page Sandbox with "Hello world!". Haribo (talk) 05:54, 2 September 2014 (UTC)Reply

Look on scripts/basic.py ;) --Dvorapa (talk) 10:43, 11 July 2017 (UTC)Reply

New files without fonts

[edit]

I would like a script to search in "special: NewFiles" articles that have no reference (<ref>, <ref name=> {{references}}, {{reflist}}, <references />, == References ==, == bibliography ==)

Purpose: Create a list on my user page to add the default without fonts

Is the regular expression correct to find and replace? "<ref>"? ^ * \ <* ref * \> -------> \ n {{Unreferenced}}. Elilopes (talk) 17:25, 7 December 2018 (UTC)Reply

See Manual:Pywikibot/listpages.py. --Dvorapa (talk) 18:17, 7 December 2018 (UTC)Reply