Manual:Pywikibot/transwikiimport.py/en

transwikiimport.py is a script used to transfer pages from a source wiki to a target wiki.

The complete edit history can be imported. So a recursive import of all transcluded pages and templates is possible.

Internal links are not repaired!

The script gives access to all options available on the Specialpage:Import and over the appropriate API (see API:Import.

Examples
Transfer all pages in category "Query service" from the source wiki to the home wiki, import all versions of the page (full history), assign the changes to the locally existing accounts, set an appropriate summary, do not overwrite existing pages when they have the same name:

Copy the page "Page:How to become famous.djvu/333" from the source wiki to the home wiki, import all versions of the page (full history), assign the changes to the locally existing accounts, set an appropriate summary, do not overwrite existing pages when they have the same name:

Copy all pages "Page:How to become famous.djvu/?" from the source wiki to the home wiki, import all versions of the page (full history), assign the changes to the locally existing accounts, set an appropriate summary, do not overwrite existing pages when they have the same name:

Copy pages 111–222 of "Page:How to become famous.djvu/?" from the source wiki to the home wiki, import all versions of the page (full history), assign the changes to the locally existing accounts, set an appropriate summary, do not overwrite existing pages when they have the same name:

The one-liner that could achieve this on a Linux system could look like:

On a Windows machine one could use:

Parameters
Pages to work on can be specified using any of:

Warning
The parameter -test disables the import and the bot prints the names of the pages that would be imported.

Since the import of pages is a quite exceptional process and potentially dangerous it should be made carefully and tested in advance.

The -test parameter can help to find out which pages would be moved and what would be the target of the import.

However it does not print the titles of the transcluded pages (e.g. templates) if -includealltemplates is set. This option is quite dangerous. If the title of an existing page on home wiki clashes with the title of one of the linked pages it would be overritten. The histories would be merged. (If the imported version is newer.)

Even if -overwrite is not set the linked page can be overwritten.

The correspondingnamespace is used only if the namespaces on both wikis do not correspond one with another.

correspondingnamespace and rootpage are mutually exclusive.

target and rootpage are mutually exclusive. (This combination does not seem to be feasible.)

If the target page already exists, the target page will be overwritten if -overwrite is set or skipped otherwise.

The module gives access to all parameters of the API (and special page).

However for most scenarios the following parameters should be avoided:


 * overwrite (by default set as False)
 * target (by default set as False)
 * includealltemplates (by default set as False)

Transwikiimportbot.py is also compatible to the transferbot module (Manual.

Rights
transwikiimport.py requires an appropriate flag be set on the account.

Even the Specialpage:Import can be accesed by administrators, tranwiki importers or importers.

Interwikisource
The list of wikis that can be used as a source is defined in the variable $wgImportSources

It can be viewed on the Specialpage:Import.