Subject: | diff against svn HEAD |
Date: | Fri, 13 Jul 2007 17:48:07 -0400 |
To: | "Grant Grueninger" <grantg [...] spamarrest.com> |
From: | "CAPTCHA Killer" <admin [...] captchakiller.com> |
Index: Myspace.pm
===================================================================
--- Myspace.pm (revision 408)
+++ Myspace.pm (working copy)
@@ -6123,11 +6123,12 @@
sub _use_captcha_killer {
my $api_key = $self->captcha_killer_api_key;
-
+ our $VERSION;
my $captcha_url = shift @_;
my $upload_filename = shift @_;
my $ua = LWP::UserAgent->new;
+ $ua->default_headers->push_header('CAPTCHA-Client' => "WWW-
Myspace-$VERSION");
push @{ $ua->requests_redirectable }, "POST";
my $captcha_id = "";
@@ -6143,13 +6144,16 @@
$captcha_id = $1;
print "GOT CAPTCHA ID: $captcha_id\n";
}
+ else {
+ return ""; # can't upload captcha ?
+ }
}
else {
- die $response->status_line;
+ return ""; # can't upload captcha ?
}
$captcha_result = "";
- for ( my $cnt = 1; $cnt < 500; $cnt++ ) {
+ for ( my $cnt = 1; $cnt < 20; $cnt++ ) {
print "ATTEMPT $cnt\n";
my $response = $ua->post( " http://www.captchakiller.com/
api.php ",
Content => [ api_key => $api_key, method =>
"get_result", captcha_id => $captcha_id ] );
@@ -6162,15 +6166,12 @@
last;
}
}
- else {
- die $response->status_line;
- }
}
- return $captcha_result;
+ return $captcha_result;
}
sub _handle_captcha {
- return "" if ( $self->captcha_killer_api_key eq "" );
+ return "" if ( $self->captcha_killer_api_key eq "" ); # not
handling CAPTCHAs
my $url = shift;
print "GOT CAPTCHA URL: $url\n";
my $file = "";
@@ -6178,7 +6179,8 @@
print "SAVING INTO FILE: $file\n";
my $solution = "";
my $res = $self->mech->get( $url, ':content_file' => $file );
- $solution = $self->_use_captcha_killer( $url, $file );
+ $solution = $self->_use_captcha_killer( $url, $file );
+ unlink( $file );
return $solution;
}