SVN: toys/fun/rsget.pl

sparky sparky at pld-linux.org
Sun Jun 7 19:32:06 CEST 2009


Author: sparky
Date: Sun Jun  7 19:32:05 2009
New Revision: 10375

Modified:
   toys/fun/rsget.pl
Log:
- added depositfiles.com


Modified: toys/fun/rsget.pl
==============================================================================
--- toys/fun/rsget.pl	(original)
+++ toys/fun/rsget.pl	Sun Jun  7 19:32:05 2009
@@ -1300,7 +1300,7 @@
 }
 
 $getters{UT} = {
-	uri => qr{uploaded\.to/file/.*?},
+	uri => qr{(uploaded|ul)\.to/.*?},
 	add => sub { Get::UploadedTo->new( @_ ) },
 };
 
@@ -1426,6 +1426,8 @@
 		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 ) {
 		$link = $1;
+	} elsif ( $body =~ /File Not Found/ ) {
+		return $self->error( "file not found" );
 	} else {
 		return $self->problem( "link", $body );
 	}
@@ -1444,7 +1446,7 @@
 		return $self->problem( "file url", $body );
 	}
 	
-	$self->wait( 30, \&stage4, "starting download in" );
+	$self->wait( 30, \&stage4, "starting in" );
 }
 
 sub stage4
@@ -1476,6 +1478,83 @@
 };
 
 # }}}
+package Get::DepositFiles; # {{{
+
+BEGIN {
+	our @ISA;
+	@ISA = qw(Get);
+}
+
+sub new
+{
+	my $proto = shift;
+	my $class = ref $proto || $proto;
+	my $url = shift;
+	Get::makenew( "DF", $class, $url );
+}
+
+sub stage1
+{
+	my $self = shift;
+	delete $self->{referer};
+
+	$self->print("starting...");
+	$self->curl( $self->{url}, \&stage2 );
+}
+
+sub stage2
+{
+	my ($self, $body, $url) = @_;
+	$self->print("starting......");
+	$self->{referer} = $url;
+
+	my $link;
+	if ( $body =~ /Such file does not exist / ) {
+		return $self->error( "file not found" );
+	} elsif ( $body =~ m#<form action="(.*?)" method="post"># ) {
+		$link = $1;
+	} elsif ( $body =~ /We are sorry, but all downloading slots for your country are busy/ ) {
+		return $self->wait( 5 * 60, \&stage1, "servers overloaded, waiting" );
+	} else {
+		return $self->problem( "link", $body );
+	}
+
+	$self->curl( $link, \&stage3, post => "gateway_result=1" );
+}
+
+sub stage3
+{
+	my ($self, $body, $url) = @_;
+	$self->{referer} = $url;
+	$self->print("starting.........");
+
+	if ( $body =~ m#<form action="(.*?)" method="get" onSubmit="download_started# ) {
+		$self->{file_url} = $1;
+	} 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" );
+	} else {
+		return $self->problem( "file url", $body );
+	}
+	
+	$self->wait( 60, \&stage4, "starting download in" );
+}
+
+sub stage4
+{
+	my $self = shift;
+	$self->print("downloading");
+
+	$self->download();
+}
+
+$getters{DF} = {
+	uri => qr{(www\.)?depositfiles\.com/.*?},
+	add => sub { Get::DepositFiles->new( @_ ) },
+};
+
+# }}}
 package main; # {{{
 
 my $get_list = 'get.list';


More information about the pld-cvs-commit mailing list