Bruger:Hebbot/kilde/SeM
Udseende
#!/usr/local/bin/perl -w use strict; use MediaWiki::Bot; my $user = 'Hebbot'; my $pass = '*******'; # create and initialize editor my $WPCom = MediaWiki::Bot->new(); my $WPDa = MediaWiki::Bot->new(); $WPCom->set_wiki({ protocol => 'http', host => 'commons.wikimedia.org', path => 'w', }); $WPDa->set_wiki({ protocol => 'http', host => 'da.wikipedia.org', path => 'w', }); $WPCom->login({ username => $user, password => $pass, }); $WPDa->login({ username => $user, password => $pass, }); my $WPDa_notice = "(vha. [[:en:Wikipedia:MediaWiki::Bot|MediaWiki::Bot]] - [[Brugerdiskussion:Heb|rapporter fejl]])"; # my $WPEn_notice = "(using [[Wikipedia:MediaWiki::Bot|MediaWiki::Bot]] - [[User talk:Heb|report error]])"; # my $WPCom_notice = "(using [[:w:Wikipedia:MediaWiki::Bot|MediaWiki::Bot]] - [[User talk:Heb|report error]])"; # action! my $text=$WPCom->get_text("Category:Current_ministers_of_Denmark"); # print $text."\n"; my @lines = split(/\n/, $text); my $inlist = 0; my @pushlines; foreach my $line (@lines) { if (index($line, 'List::end') > -1) { $inlist = 0; } if ($inlist == 1) { push @pushlines, $line; } if (index($line, 'List::start') > - 1) { $inlist = 1; } } my $endtext = qq{<noinclude>'''Automatisk opdateret liste''' Denne liste bliver automatisk opdateret af [[Bruger:Hebbot|Hebbot]] en gang i timen fra [[:Commons:Category:Current ministers of Denmark|Current ministers of Denmark]] p [[:Commons:Forside|Wikimedia Commons]]. ∆ndringer skal derfor foretages der og ikke her p listen! ---- </noinclude> }; $endtext .= join("\n", @pushlines); $WPDa->edit({ page => "Wikipedia:Skyd en minister/Liste", text => $endtext, summary => "Automatisk opdatering fra [[:Commons:Category:Current ministers of Denmark]] $WPDa_notice", });