forked from MediaWiki-Bot/MediaWiki-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Using MediaWiki::Bot
Mike.lifeguard edited this page Aug 13, 2011
·
1 revision
#!/usr/bin/perl
use strict;
use warnings;
# Include the MediaWiki::Bot methods in your script.
use MediaWiki::Bot;
# Username and password.
my $user = 'me';
my $pass = 'supersecretpassword';
#Create a Perlwikipedia object, and have it automatically log in and configure itself
my $bot = MediaWiki::Bot->new({
protocol => 'https',
host => 'secure.wikimedia.org',
path => 'wikipedia/en/w',
login_data => { username => $user, password => $pass },
debug => 1, # Turn debugging on, to see what the bot is doing
});
#Pull the wikitext of the Wikipedia Sandbox
my $article = 'Wikipedia:Sandbox';
my $text = $bot->get_text($article);
# append something to the text
$text = $text . "Experimenting a little bit...\n";
# Submit to Wikipedia.
# Note: This does not warn of edit conflicts, it just overwrites existing text.
$bot->edit({
page => $article,
text => $text,
summary => 'A bot test edit',
is_minor=> 0, # not a minor edit
});Support options:
- More documentation on the CPAN
- Visit
#perlwikipediaon irc.freenode.net - Email
perlwikibot@googlegroups.com