Author: sparky Date: Thu Jan 8 20:49:40 2009 New Revision: 10058 Modified: toys/fun/rsget.pl Log: - added uploaded.to
Modified: toys/fun/rsget.pl ============================================================================== --- toys/fun/rsget.pl (original) +++ toys/fun/rsget.pl Thu Jan 8 20:49:40 2009 @@ -3,6 +3,11 @@ # 2008 (c) Przemysław Iskra <[email protected]> # Use/modify/distribute under GPL v2 or newer. # +=item TODO: +- removing URI from list should stop download +- new URI higher in the list should replace any connection + to the same network is still in the wait stage +=cut use strict; use warnings; use Time::HiRes; @@ -904,6 +909,10 @@ sub stage2 { my ($self, $body, $url) = @_; + + if ( $url =~ m{/(upload|error)\.html} ) { + return $self->error( "some problem" ); + } $self->print("downloading"); $self->{referer} = $url; @@ -1102,6 +1111,55 @@ } # }}} +package Get::UploadedTo; # {{{ + +BEGIN { + our @ISA; + @ISA = qw(Get); +} + +sub new +{ + my $proto = shift; + my $class = ref $proto || $proto; + my $url = shift; + + Get::makenew( "UT", $class, $url ); +} + +sub stage1 +{ + my $self = shift; + + $self->print("starting..."); + delete $self->{referer}; + $self->curl( $self->{url}, \&stage2 ); +} + +sub stage2 +{ + my ($self, $body, $url) = @_; + $self->print("starting......"); + $self->{referer} = $url; + + if ( $body =~ /Or wait (\d+) minutes/ ) { + return $self->wait( $1 * 60, \&stage1, "free limit reached, waiting" ); + } + ($self->{file_url}) = ($body =~ m#<form name="download_form" method="post" action="(.*)">#); + my ($wait) = ($body =~ m#var secs = (\d+); // Wartezeit#); + + $self->wait( $wait, \&stage3, "starting in" ); +} + +sub stage3 +{ + my $self = shift; + $self->print("downloading"); + + $self->download( post => "download_submit=Download"); +} + +# }}} package main; # {{{ my $get_list = shift @ARGV || 'get.list'; @@ -1135,6 +1193,9 @@ } elsif ( $line =~ m{^\s*(http://(www\.)?megaupload\.com/\?d=.*?)\s*$} ) { $url = $1; new Get::MegaUpload( $1 ); + } elsif ( $line =~ m{^\s*(http://uploaded\.to/file/.*?)\s*$} ) { + $url = $1; + new Get::UploadedTo( $1 ); } if ( $url ) { _______________________________________________ pld-cvs-commit mailing list [email protected] http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
