Jump to content

Wikitool

From Meta, a Wikimedia project coordination wiki

wikitool is an utility written in Perl by User:Edward Chernenko for use in bots written in different languages (for example, from UNIX shell).

It uses CMS::MediaWiki module.

Usage

[edit]

Before using wikitool, you should create configuration file. See sample here.

$wiki_host = "ru.wikipedia.org"; # This is wiki host
$wiki_path = "w"; # This is path to index.php script
$wiki_user = "Edward Chernenko"; # For uploads, optional
$wiki_pass = "123456:-)7"; 

wikitool works in two modes: upload and download. Download mode syntax:

./wikitool.pl PAGE

(to write raw code of PAGE to standard output). You may redirect this:

./wikitool.pl PAGE >mypage.txt

Upload mode syntax:

./wikitool.pl -e PAGE

(to read text from standard input and upload it). You may redirect this:

./wikitool.pl -e PAGE <mypage.txt

Optional parameter for upload mode is -s, summary. By default (if not specified) it is "Bot: auto-upload".

Example

[edit]
./wikitool.pl PAGE | wikify_me | ./wikitool.pl -e PAGE -s "Auto-wikified"

Downloads PAGE, passes text through wikify_me filter and uploads it wiki "Auto-wikified" summary.

Where to get

[edit]

You may get the last version or wikitool here. This tools is granted under terms of GNU General Public License 2.