-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this will delete pages marked for deletion on the deletionpedia
- Loading branch information
1 parent
95a4df9
commit 0b6b830
Showing
3 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1 1344075503.56 wikipedia:en | ||
1 1344241848.65 wikipedia:en |