Skip to content

Commit

Permalink
this will delete pages marked for deletion on the deletionpedia
Browse files Browse the repository at this point in the history
  • Loading branch information
h4ck3rm1k3 committed Aug 6, 2012
1 parent 95a4df9 commit 0b6b830
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
File renamed without changes.
70 changes: 70 additions & 0 deletions fixattackpages_deletionpedia.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
use warnings;
use strict;

use MediaWiki::API;

# http://seahttp://search.cpan.org/~dcollins/MediaWiki-Bot-2.3.1/lib/MediaWiki/Bot.pm

sub EditPage {
my $mw=shift;
my $pagename = shift;
$mw->edit( {
action => 'delete', title => $pagename, reason => 'Attack Pages' } )
|| warn $mw->{error}->{code} . ': ' . $mw->{error}->{details};

}

sub GetPages {
my $mw = MediaWiki::API->new();
$mw->{config}->{api_url} = 'http://deletionpedia.dbatley.com/w/api.php';

my $mw2 = MediaWiki::API->new();
$mw2->{config}->{api_url} = 'http://speedydeletion.wikia.com/api.php';
my $username;
my $userpass;
open IN, "<config.cfg" or die;
while (<IN>)
{
if (/username:(.+)/) { $username=$1; }
elsif (/userpass:(.+)/) { $userpass=$1; }
}
close IN;
#print "User:$username Pass:$userpass\n";
die unless $username;
die unless $userpass;

$mw2->login( { lgname => $username, lgpassword => $userpass } )
|| die $mw2->{error}->{code} . ': ' . $mw2->{error}->{details};


foreach my $cat (
"Deletionpedia:Pages_blanked_after_complaints",
"Deletionpedia:Blanked_pages",
"Deletionpedia:Dangerous_pages"
){
print "checking $cat\n";
# get a list of articles in category
my $articles = $mw->list ( {
action => 'query',
list => 'categorymembers',
# cmtitle => $cat,
cmcategory => $cat,
# cmlimit => 'max'
cmlimit => '50',


#http://deletionpedia.dbatley.com/w/api.php?format=json&action=query&cmcategory=Deletionpedia:Pages_blanked_after_complaints&cmlimit=50&list=categorymembers
} )
|| die $mw->{error}->{code} . ': ' . $mw->{error}->{details};

# and print the article titles
foreach (@{$articles}) {
print "going to delete $_->{title}\n";
EditPage $mw2, $_->{title};
}
}

}


GetPages;
2 changes: 1 addition & 1 deletion pywikibot/throttle.ctrl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1 1344075503.56 wikipedia:en
1 1344241848.65 wikipedia:en

0 comments on commit 0b6b830

Please sign in to comment.