SVN: toys/fun/rsget.pl

sparky sparky at pld-linux.org
Mon Jun 8 03:51:28 CEST 2009


Author: sparky
Date: Mon Jun  8 03:51:27 2009
New Revision: 10383

Modified:
   toys/fun/rsget.pl
Log:
- don't fail when multi-download detected, just wait somw random time


Modified: toys/fun/rsget.pl
==============================================================================
--- toys/fun/rsget.pl	(original)
+++ toys/fun/rsget.pl	Mon Jun  8 03:51:27 2009
@@ -522,6 +522,12 @@
 	Wait::start( $self, $time );
 }
 
+sub multi
+{
+	my $self = shift;
+	return $self->wait( 5 * 60 * rand, \&start, "multi-download not allowed, waiting" );
+}
+
 sub finish
 {
 	my $self = shift;
@@ -642,7 +648,7 @@
 	$self->{referer} = $url;
 
 	if ( $body =~ /Please wait until the download is completed/m ) {
-		return $self->error( "multi-download not allowed" );
+		return $self->multi();
 	}
 	if ( $body =~ /You have reached the download limit for free-users\./m ) {
 		$body =~ /Instant download access! Or try again in about ([0-9]+) minutes\./m;
@@ -1359,7 +1365,7 @@
 		return $self->error( "file not found" );
 	}
 	if ( $body =~ /You are currently downloading/ ) {
-		return $self->error( "multi-download not allowed" );
+		return $self->multi();
 	} elsif ( $body =~ /starthtimer[\s\S]*timerend=d\.getTime\(\)\+(\d+);/m and $1 > 0 ) {
 		return $self->wait( 1 + int ( $1 / 1000 ), \&stage1, "free limit reached, waiting" );
 	}
@@ -1441,7 +1447,7 @@
 
 	my $link;
 	if ( $body =~ /You are currently downloading/ ) {
-		return $self->error( "multi-download not allowed" );
+		return $self->multi();
 	} elsif ( $body =~ /starthtimer[\s\S]*timerend=d\.getTime\(\)\+(\d+);/m and $1 > 0 ) {
 		return $self->wait( 1 + int ( $1 / 1000 ), \&stage1, "free limit reached, waiting" );
 	} elsif ( $body =~ m#<form action="(.*)" method="post">\s*<input type="submit" value="Free#m ) {
@@ -1483,7 +1489,7 @@
 	my ($self, $body, $url) = @_;
 	# file turned out to be html, meens we need to wait
 	if ( $body =~ /You are currently downloading too many files at once/ ) {
-		return $self->error( "multi-download not allowed" );
+		return $self->multi();
 	} elsif ( $body =~ /Please wait (\d+) minutes to download more files/ ) {
 		return $self->wait( $1 * 60 - 30, \&stage1, "free limit reached, waiting" );
 	} elsif ( $body =~ /Please wait (\d+) seconds to download more files/ ) {
@@ -1553,7 +1559,7 @@
 	} elsif ( $body =~ m#<span class="html_download_api-limit_interval">(\d+)</span># ) {
 		return $self->wait( $1, \&stage1, "free limit reached, waiting" );
 	} elsif ( $body =~ m#<span class="html_download_api-limit_parallel"># ) {
-		return $self->error( "multi-download not allowed" );
+		return $self->multi();
 	} else {
 		return $self->problem( "file url", $body );
 	}


More information about the pld-cvs-commit mailing list