# $Id: SharePlace 10871 2009-10-27 11:36:04Z sparky $
# Get::SharePlace - File getter plugin for rsget.pl
#
# 2009 (c) Przemysław Iskra <sparky@pld-linux.org>
#		This program is free software,
# you may distribute it under GPL v2 or newer.

name: SharePlace
short: SP
uri: qr{shareplace\.com/\?[0-9A-F]+(/.*)?}
slots: max
status: OK 2009-10-23

unify:
	return "http://shareplace.com/?$1"
		if m{shareplace\.com/\?([0-9A-F]+)(/.*)?};

start:
	GET( $-{_uri} );

	ERROR( "file not found" )
		if /Your requested file is not found/;

	! m#<b>Filename: </b>(.*)<b><br>\s*File size: </b>($STDSIZE)<b><br>#s;
	INFO( name => $1, asize => $2 );

	RESTART( - irand( 60, 300 ), "limit reached" )
		if /You have got max allowed download sessions from the same IP/;

	! m#var cgcsccccsccrctcc = unescape\(\s*([a-zA-Z0-9_]+?)\s*\);#;
	my $varname = $1;

	! m#var $varname = '(.+?)';#;
	$-{file_uri} = uri_unescape( $1 );
	$-{file_uri} =~ s/^.{3}//;

	! m#var zziptimme = (\d+);#;
	WAIT( $1, "starting download" );

	CLICK_DOWNLOAD( $-{file_uri} );

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