SVN: toys/rsget.pl/RSGet/Get.pm

sparky sparky at pld-linux.org
Wed Oct 21 21:24:14 CEST 2009


Author: sparky
Date: Wed Oct 21 21:24:14 2009
New Revision: 10795

Modified:
   toys/rsget.pl/RSGet/Get.pm
Log:
- added click methods: random short delay before getting file
- captcha must have been ok if download has started


Modified: toys/rsget.pl/RSGet/Get.pm
==============================================================================
--- toys/rsget.pl/RSGet/Get.pm	(original)
+++ toys/rsget.pl/RSGet/Get.pm	Wed Oct 21 21:24:14 2009
@@ -169,6 +169,23 @@
 	close $c;
 }
 
+sub click
+{
+	my $self = shift;
+	my @opts = @_;
+	$self->{_click_opts} = \@opts;
+	return $self->wait( \&click_start_get, 3 + int rand 10,
+		"clicking link", "delay" );
+}
+
+sub click_start_get
+{
+	my $self = shift;
+	my @opts = @{ $self->{_click_opts} };
+	delete $self->{_click_opts};
+	return $self->get( @opts );
+}
+
 sub get
 {
 	my $self = shift;
@@ -199,6 +216,23 @@
 	&$func( $self );
 }
 
+sub click_download
+{
+	my $self = shift;
+	my @opts = @_;
+	$self->{_click_opts} = \@opts;
+	return $self->wait( \&click_start_download, 3 + int rand 10,
+		"clicking download link", "delay" );
+}
+
+sub click_start_download
+{
+	my $self = shift;
+	my @opts = @{ $self->{_click_opts} };
+	delete $self->{_click_opts};
+	return $self->download( @opts );
+}
+
 sub download
 {
 	my $self = shift;
@@ -374,6 +408,8 @@
 		globals => { fname => $fname, fsize => $fsize },
 		options => { fname => $fname, @osize } );
 	RSGet::FileList::update();
+
+	$self->captcha_result( "ok" );
 }
 
 1;


More information about the pld-cvs-commit mailing list