# $Id: FreakShare 11111 2010-01-13 13:09:39Z sparky $
# Get::FreakShare - File getter plugin for rsget.pl
#
# 2009-2010 (c) Przemysław Iskra <sparky@pld-linux.org>
#		This program is free software,
# you may distribute it under GPL v2 or newer.

name: FreakShare
short: FS
web: "http://freakshare.net/"
tos: "http://freakshare.net/terms-of-service.html"
uri: qr{freakshare\.net/files/}
cookie: fs
status: OK 2009-10-22

start:
	GET( $-{_uri} );

	ERROR( "file not found" ) if /Sorry, this Download doesnt exist anymore/;
	RESTART( - irand( 60, 300 ), "free limit reached" )
		if /Sorry, your Traffic is used up for today/;

	! m#<h1 class="box_heading" style="text-align:center;">(.*)</h1>#;
	INFO( name => $1, size => -1 );

	! $-{form} = $self->form( match => { body => qr/"Free Download"/ } );

	! m#var time = (\d+)(?:\.\d+);\s*var intervall;#;
	WAIT( -$1, "starting" );

	CLICK( $-{form}->post() );
	
	! $-{dlform} = $self->form( match => { onsubmit => qr/^disableButton/ } );

	! m#var time = (\d+)(?:\.\d+);\s*var intervall;#;
	WAIT( $1, "starting download" );

	CLICK_DOWNLOAD( $-{dlform}->post() );

	MULTI() if /Sorry, you cant  download more then 1 at time/;

# vim: filetype=perl:ts=4:sw=4
