ebooksgratis.com

See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
User:Chris G Bot/sourcecode - Wikipedia, the free encyclopedia

User:Chris G Bot/sourcecode

From Wikipedia, the free encyclopedia

#!/usr/bin/perl
 
use Perlwikipedia;
 
#Create all the Perl Wikipedia Stuff 
        print "Bot Starting Up\n";
        #Create Perl Wikipedia Object
        print "\tCreating Perl Wikipedia Object.\n";
        $editor=Perlwikipedia->new('Chris G Bot') or die "Error Creating Object : $!\n";
        print "\tObject Created.\n";
 
        # Turn debugging on, to see what the bot is doing
        print "\tActivating Debuging.\n";
        $editor->{debug} = 1;
        print "\tDebuging Activated.\n";
        print "Bot Started\n";
 
#Login
        login();
 
 
 
#List the articles on Wikipedia:WikiProject Deletion sorting/Australia
        my $list1 = listArticles1();
        my $list2 = listArticles2();
        my $list3 = listArticles3();
        my $list4 = listArticles4();
 
#update the page
        updatePage($list1);
        print "YAY ALL TASKS ARE DONE!!!!!\n";
 
sub login {
        #This sub contains all the code to log the bot in
        # Username and password (change these when the bot has an account). 
        print "Bot is now logging in.\n";
 
        my $username = 'Chris G Bot'; 
        my $password = 'password';
 
        print "\tBot is now trying to log in as $username with $password as password.\n"; 
 
        #try to login - if fails exit with error message      
        $editor->login($username, $password);
 
        print "\tBot is now logged in.\n";
 
        #Sleep for 10 sec
        print "\tSleeping for 10 sec\n";
 
        print "Bot now logged in.\n";
}
 
 
sub listArticles1 {
print "Listing articles on : Wikipedia:WikiProject Deletion sorting/Australia.\n";
        #Get the code from Wikipedia:WikiProject Deletion sorting/Australia
 
                #Delcerations
                my $pagename = "Wikipedia:WikiProject Deletion sorting/Australia";
                my $revid = 'prev';
                my $section_number = 1;
 
                #Get the code
                print "\tGetting code from $pagename.\n"; 
                my $code = $editor->get_text($pagename,$revid,$section_number) or die "ERROR getting code from $pagename. Full Deatials : $!";
 
                print "\tDone!\n";
 
        #Clean the code
                print "\tCleaning Code.\n";
                $code =~ s^==Australia-related Articles for Deletion debates==^^ig;
 
                $code =~ s^{{Wikipedia:Articles for deletion^* {{On AFD|^ig;
$code =~ s^/^^ig;
print $code;
sleep 10;
                return $code;
 
}
sub listArticles2 {
print "Listing articles on : Wikipedia:WikiProject Deletion sorting/Australia.\n";
        #Get the code from Wikipedia:WikiProject Deletion sorting/Australia
 
                #Delcerations
                my $pagename = "Wikipedia:WikiProject Deletion sorting/Australia";
                my $revid = 'prev';
                my $section_number = 2;
 
                #Get the code
                print "\tGetting code from $pagename.\n"; 
                my $code = $editor->get_text($pagename,$revid,$section_number) or die "ERROR getting code from $pagename. Full Deatials : $!";
 
                print "\tDone!\n";
 
        #Clean the code
                print "\tCleaning Code.\n";
                $code =~ s^==Australia-related Miscellany for deletion==^^ig;
 
 
                return $code;
 
}
sub listArticles3 {
print "Listing articles on : Wikipedia:WikiProject Deletion sorting/Australia.\n";
        #Get the code from Wikipedia:WikiProject Deletion sorting/Australia
 
                #Delcerations
                my $pagename = "Wikipedia:WikiProject Deletion sorting/Australia";
                my $revid = 'prev';
                my $section_number = 3;
 
                #Get the code
                print "\tGetting code from $pagename.\n"; 
                my $code = $editor->get_text($pagename,$revid,$section_number) or die "ERROR getting code from $pagename. Full Deatials : $!";
 
                print "\tDone!\n";
 
        #Clean the code
                print "\tCleaning Code.\n";
                $code =~ s^==Australia-related Templates for Discussion==^^ig;
 
 
                return $code;
 
}
sub listArticles4 {
print "Listing articles on : Wikipedia:WikiProject Deletion sorting/Australia.\n";
        #Get the code from Wikipedia:WikiProject Deletion sorting/Australia
 
                #Delcerations
                my $pagename = "Wikipedia:WikiProject Deletion sorting/Australia";
                my $revid = 'prev';
                my $section_number = 4;
 
                #Get the code
                print "\tGetting code from $pagename.\n"; 
                my $code = $editor->get_text($pagename,$revid,$section_number) or die "ERROR getting code from $pagename. Full Deatials : $!";
 
                print "\tDone!\n";
 
        #Clean the code
                print "\tCleaning Code.\n";
                $code =~ s^==Australia-related Categories for Discussion==^^ig;
 
 
                return $code;
 
}
 
 
sub updatePage {
        my $Add = $list1;
 
 
 
        #Get the code from the page
        my $pagename = "Wikipedia:Australian Wikipedians' notice board/AfD";
        print "\tGettting code from $pagename\n";
        my $code = $editor->get_text($pagename) or die "ERRROR Getting text from $pagename Full details : $!.\n";
 
        print "\tDone.\n";
        my $code3 = $code;
 
 
        #Clean the code
 
                print "\tCleaning Code.\n";
                my @code = split(/[<][!][-][-] [b][o][t] [s][t][a][r][t] [a][f][d] [(][d][o] [n][o][t] [r][e][m][o][v][e][)] [-][-][>]/i,$code);
                my @code2 = split(/[<][!][-][-] [b][o][t] [e][n][d] [a][f][d] [(][d][o] [n][o][t] [r][e][m][o][v][e][)] [-][-][>]/i,$code[1]);
 
                $code = $code[0] . '<!-- Bot Start Afd (Do not Remove) -->' . $Add . "<!-- Bot End Afd (Do not Remove) -->" . $code2[1];
                print "\tCleaning Code.\n";
                my @code = split(/[<][!][-][-] [b][o][t] [s][t][a][r][t] [m][f][d] [(][d][o] [n][o][t] [r][e][m][o][v][e][)] [-][-][>]/i,$code);
                my @code2 = split(/[<][!][-][-] [b][o][t] [e][n][d] [m][f][d] [(][d][o] [n][o][t] [r][e][m][o][v][e][)] [-][-][>]/i,$code[1]);
 
                $code = $code[0] . '<!-- Bot Start Mfd (Do not Remove) -->' . $list2 . "<!-- Bot End Mfd (Do not Remove) -->" . $code2[1];
                print "\tCleaning Code.\n";
                my @code = split(/[<][!][-][-] [b][o][t] [s][t][a][r][t] [t][f][d] [(][d][o] [n][o][t] [r][e][m][o][v][e][)] [-][-][>]/i,$code);
                my @code2 = split(/[<][!][-][-] [b][o][t] [e][n][d] [t][f][d] [(][d][o] [n][o][t] [r][e][m][o][v][e][)] [-][-][>]/i,$code[1]);
 
                $code = $code[0] . '<!-- Bot Start Tfd (Do not Remove) -->' . $list3 . "<!-- Bot End Tfd (Do not Remove) -->" . $code2[1];
                print "\tCleaning Code.\n";
                my @code = split(/[<][!][-][-] [b][o][t] [s][t][a][r][t] [c][f][d] [(][d][o] [n][o][t] [r][e][m][o][v][e][)] [-][-][>]/i,$code);
                my @code2 = split(/[<][!][-][-] [b][o][t] [e][n][d] [c][f][d] [(][d][o] [n][o][t] [r][e][m][o][v][e][)] [-][-][>]/i,$code[1]);
 
                $code = $code[0] . '<!-- Bot Start Cfd (Do not Remove) -->' . $list4 . "<!-- Bot End Cfd (Do not Remove) -->" . $code2[1];
        #Update page if it needs updating
        if ($code ne $code3) {
        print "\tUpdating page.\n";
        print $code;
        sleep 60;
        my $edit_summary = "Updating page with content from [[Wikipedia:WikiProject Deletion sorting/Australia]] (BOT EDIT).";
        print $code;
 
        $editor->edit($pagename,$code,$edit_summary) or die "ERROR Updating $pagename : $!.\n";
 
        print "\tDone.\n";
        }
 
        else {
        print "\tPage dosn't need updating will not update.\n";
        }
 
        print "Done.\n";
}


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -