SVN: toys/rsget.pl/Get/RapidShare

sparky sparky at pld-linux.org
Thu Nov 11 13:12:46 CET 2010


Author: sparky
Date: Thu Nov 11 13:12:46 2010
New Revision: 11906

Modified:
   toys/rsget.pl/Get/RapidShare
Log:
- rs doesn't like when we use old uris - try to avoid them


Modified: toys/rsget.pl/Get/RapidShare
==============================================================================
--- toys/rsget.pl/Get/RapidShare	(original)
+++ toys/rsget.pl/Get/RapidShare	Thu Nov 11 13:12:46 2010
@@ -19,29 +19,31 @@
 	return $_;
 
 start:
-	GET( $-{_uri} );
+	$-{__uri} = $-{_uri} unless $-{__uri};
 
-	RESTART( -300, "must wait: $1" )
-		if /^ERROR: (Please stop floo.*|All free download slots are full.*)/;
+	GET( $-{__uri} );
 
 	ERROR( "file not found: $1" )
-		if /^ERROR: (.*)/
-			and substr( $1, 0, 16 ) ne "You need to wait"
-			and substr( $1, 0, 17 ) ne "You need RapidPro";
-
-	GOTO stage_uri_complete
-		unless m{<script type="text/javascript">location="(.*?)"};
-	$-{_referer} = undef;
-	GET( "http://rapidshare.com$1" );
-
-stage_uri_complete:
-	! ( $-{id}, $-{name}, my $size ) = $-{_referer} =~ m{#!download\|[0-9a-z]+\|(\d+)\|(.+?)\|(\d+)};
-	INFO( name => $-{name}, asize => "$size KB" );
+		if /^ERROR: (File .*)/;
+
+	if ( m{<script type="text/javascript">location="(.*?)"} ) {
+		$-{__uri} = "http://rapidshare.com$1";
+
+		RESTART( 1, "found correct uri: $-{__uri}" );
+	}
+
+	if ( ( $-{id}, $-{name}, my $size ) = $-{_referer} =~ m{#!download\|[0-9a-z]+\|(\d+)\|(.+?)\|(\d+)} ) {
+		INFO( name => $-{name}, asize => "$size KB" );
+	} else {
+		ERROR( "unknown error, uri is: $-{_referer}" );
+	}
 	
 	CLICK( "http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=download_v1&try=1&fileid=$-{id}&filename=$-{name}" );
 
 	MULTI( $1 )
 		if /^(ERROR: You need RapidPro.*)/;
+	RESTART( -60, "must wait: $1" )
+		if /^ERROR: (Please stop floo.*|All free download slots are full.*)/;
 	RESTART( -$2, "free limit reached: $1" )
 		if /^(ERROR: You need to wait (\d+) seconds.*)/;
 


More information about the pld-cvs-commit mailing list