Jump to: navigation, search
Language: English  • العربية • français • italiano • 日本語
Bug blank.svg
Wikimedia Git repository has this file: is part of the Pywikipedia bot framework.
With this script you can create pages from a textfile.
The file should be in UTF-8 and if you want to create multiple pages from a file you should separate the articles as specified by the -start and -end arguments.

The pagename will be the first headword in your textfile (the first word between ''' '''). It is currently automatically inserted in the uploaded page.

NOTE: the script parses the input text in a recursive way, so it can easily run out of memory if the file is very large. If memory problems are encountered, it is advisable to break the input text into multiple files, and upload them individually.

Specific arguments:

arg Description Default
-start:xxxx Specify the text that is the beginning of a page {{-start-}}
-end:yyyy Specify the text that is the end of a page {{-stop-}}
-file:zzz Give the filename we are getting our material from dict.txt
-include The beginning and end text should be included in the page. do not include
-nocontent If page has this statement it doesn't append (example: -nocontents:"{{infobox")
-notitle Do not include the title line in the page. include title line
-titlestart:xxx Use xxx in place of ''' for identifying the beginning of the page title '''
-titleend:xxx Use xxx in place of ''' for identifying the end of the page title '''
-summary:xxx Use xxx as the summary for the upload. (a translation of) "Automated import of articles"
-autosummary Use mediawiki default summary not selected
-minor Set minor edit flag on page edits. not selected
-simulate Do not really upload pages, just check and report messages. not selected
-safe If the page to be uploaded already exists, do nothing, i.e. skip it. -safe
-appendtop If the page to be uploaded already exists, add the text to the top of it.
-appendbottom If the page to be uploaded already exists, add the text to the bottom of it. If you're using -notitle, any leading whitespace is ignored: to add a newline before your text, hack the line
                pywikibot.output(u"Page %s already exists, appending on bottom!"
                                     % title)
                contents = page.get() + contents


                contents = page.get() + '\n' + contents
-force If the page to be uploaded already exists, overwrite the existing page.

E.g.: Filename.txt

Text here

Another text

Usage: [global-arguments] -start:xxxx -end:yyyy -file:Filename.txt

Global arguments available for all bots

arg Description Default compat core
-dir:PATH Read the bot's configuration data from directory given by PATH, instead of from the default directory.
-lang:xx Set the language of the wiki you want to work on, overriding the configuration in xx should be the language code. parameter: mylang
-family:xyz Set the family of the wiki you want to work on, e.g. wikipedia, wiktionary, commons, wikitravel, …. This will override the configuration in settings. parameter: family
-user:xyz Log in as user 'xyz' instead of the default username.
-daemonize:xyz Immediately return control to the terminal and redirect stdout and stderr to xyz (only use for bots that require no input from stdin).
-help Show a help text for the invoked script.
-log Enable the logfile. Logs will be stored in the logs subdirectory. parameter: log ?
-log:xyz Enable the logfile, using xyz as the filename.
-nolog Disable the logfile (if it's enabled by default).
-maxlag Sets a new maxlag parameter to a number of seconds. Defer bot edits during periods of database server lag. Default is set by
Enable the logfile and include extensive debugging data for component "item" (for all components if the second form is used).
Set the minimum time (in seconds) the bot will wait between saving pages. parameter: put_throttle
Make the program output more detailed messages than usual to the standard output about its current work, or progress, while it is proceeding. This may be helpful when debugging or dealing with unusual situations. not selected
Toggles the cosmetic_changes setting made in or to its inverse and overrules it. All other settings and restrictions are untouched. not selected
-simulate Disables writing to the server. Useful for testing and debugging of new code (if given, doesn't do any real changes, but only shows what would have been changed).
-<config_var>:n You may use all given numeric config variables as option and modify it with command line.