VOOZH about

URL: https://en.wikipedia.org/wiki/User:Tweakbot/tweakbot.pl

⇱ User:Tweakbot/tweakbot.pl - Wikipedia


Jump to content
From Wikipedia, the free encyclopedia
/Wikipedia.pm /Wikipedia/Page.pm
#!/usr/bin/perl -w
usestrict;

useconstantUSERNAME=>'Tweakbot';
useconstantPASSWORD=>'';# password deleted

useconstantCOOKIES=>'tweakbot.txt';

useconstantEDIT_SUMMARY=>'Tweakbot reporting for duty! (replaced depreciated template)';
useconstantEDIT_MINOR=>1;

useWikipedia;

my$wiki=Wikipedia->new(
'username'=>USERNAME,
'password'=>PASSWORD,
'cookie_file'=>COOKIES,
);

foreachmy$pagename(@ARGV){
my$page=$wiki->get_page($pagename);
my$old_contents=$page->contents;
(my$new_contents=$old_contents)=~s/\{\{ref-section\}\}/==References==\n{{Reflist}}/gi;
unless($new_contentseq$old_contents){
printSTDERR"updating `$pagename'\n";
print"$new_contents\n";
$page->put_contents($new_contents,EDIT_SUMMARY,EDIT_MINOR);
}else{
printSTDERR"nothing to do for `$pagename'\n";
}
}