SVN: toys/rsget.pl/Get/RapidShareDE

sparky sparky at pld-linux.org
Thu Oct 22 21:50:12 CEST 2009


Author: sparky
Date: Thu Oct 22 21:50:12 2009
New Revision: 10826

Modified:
   toys/rsget.pl/Get/RapidShareDE
Log:
- added captcha processor, use new tools; checked


Modified: toys/rsget.pl/Get/RapidShareDE
==============================================================================
--- toys/rsget.pl/Get/RapidShareDE	(original)
+++ toys/rsget.pl/Get/RapidShareDE	Thu Oct 22 21:50:12 2009
@@ -3,7 +3,7 @@
 name: RapidShareDE
 short: RS.de
 uri: qr{rapidshare\.de/}
-status: OK 2009-10-13
+status: OK 2009-10-22
 
 start:
 	GET( $-{_uri} );
@@ -13,7 +13,7 @@
 
 	! $-{form} = $self->form( match => { action => qr{^http://rapidshare\.de$} } );
 	$-{form}->set( "dl.start" => "Free" );
-	GET( $-{form}->post() );
+	CLICK( $-{form}->post() );
 
 	! m{<p><p>You have requested the file <b>(.*?)</b> \(($STDSIZE)\)\.</p>};
 	INFO( name => $1, asize => $2 );
@@ -35,7 +35,13 @@
 
 	GET( $-{img}, keep_referer => 1 );
 
-	CAPTCHA( "image/png" );
+	CAPTCHA(
+		qr/[A-Z0-9]{3}/,
+		process => \&rsde_decaptcha
+	);
+
+	RESTART( -1, "captcha unsolved" )
+		unless defined $_;
 
 	$-{dlform}->set( captcha => $_ );
 
@@ -43,7 +49,27 @@
 
 	DOWNLOAD( $-{dlform}->post() );
 
-	RESTART( -1, "invalid captcha" )
-		if /Access-code wrong/;
+	if ( /Access-code wrong/ ) {
+		CAPTCHA_RESULT( "FAIL" );
+		RESTART( -1, "invalid captcha" );
+	}
+
+perl:
+
+sub rsde_color_select
+{
+	my @s = sort { $a <=> $b } @_;
+	return $s[0];
+}
+
+sub rsde_decaptcha
+{
+	my $img = shift;
+
+	$img->color_filter( \&rsde_color_select );
+	$img->luma_emphasize( 100, 200 );
+	return $img->ocr();
+}
+
 
 # vim:ts=4:sw=4


More information about the pld-cvs-commit mailing list