Author: sparky
Date: Sun Jun  7 15:42:00 2009
New Revision: 10373

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


Modified: toys/fun/rsget.pl
==============================================================================
--- toys/fun/rsget.pl   (original)
+++ toys/fun/rsget.pl   Sun Jun  7 15:42:00 2009
@@ -12,9 +12,17 @@
   (catch non-existing files quickly)
 - restart download if same URI has been added second time
 - MegaUpload: update, there is new page, and new captcha
+- OdSiebie: there is a captcha now
 
-Wishlist:
-- multiple source IP support
+=item Status:
+- RS: 2009-06-07 OK
+- NL: 2009-06-07 OK
+- OS: not working, captcha not supported
+- MU: not working, new captcha not supported
+- UT: 2009-06-07 OK
+- HF: 2009-06-07 OK
+
+=item Wishlist:
 - handle multiple alternatives for same file
 - add more servers
 
@@ -1272,6 +1280,90 @@
 };
 
 # }}}
+package Get::HotFile; # {{{
+
+BEGIN {
+       our @ISA;
+       @ISA = qw(Get);
+}
+
+sub new
+{
+       my $proto = shift;
+       my $class = ref $proto || $proto;
+       my $url = shift;
+       Get::makenew( "HF", $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;
+
+       unless ( length $body ) {
+               return $self->error( "file not found" );
+       }
+       if ( $body =~ /You are currently downloading/ ) {
+               return $self->error( "multi-download not allowed" );
+       } 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" );
+       }
+       my @post;
+       my $link;
+       my @body = split /\n+/, $body;
+       while ( $_ = shift @body ) {
+               if ( not defined $link ) {
+                       $link = $1 if /<form action="(.*?)" method=post 
name=f>/m;
+               } elsif ( /<input type=hidden name=(.*?) value=(.*?)>/ ) {
+                       push @post, "$1=$2";
+               } elsif ( m#</form># ) {
+                       last;
+               }
+       }
+       unless ( defined $link ) {
+               return $self->problem( "link", $body );
+       }
+       $self->{action} = $link;
+       $self->{post} = join "&", @post;
+
+       $self->wait( 30, \&stage3, "starting download in" );
+}
+
+sub stage3
+{
+       my $self = shift;
+       $self->print("starting.........");
+
+       $self->curl( $self->{action}, \&stage4, post => $self->{post} );
+}
+
+sub stage4
+{
+       my ($self, $body, $url) = @_;
+       $self->print("downloading");
+       if ( $body =~ m#<a href="(.*?)">Click here to download</a># ) {
+               $self->{file_url} = $1;
+       }
+
+       $self->download();
+}
+
+$getters{HF} = {
+       uri => qr{hotfile\.com/.*?},
+       add => sub { Get::HotFile->new( @_ ) },
+};
+
+# }}}
 package main; # {{{
 
 my $get_list = 'get.list';
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to