# $Id: SharePlace 11716 2010-07-27 20:18:28Z sparky $
# Get::SharePlace - 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: SharePlace
short: SP
web: "http://shareplace.com/"
tos: "http://shareplace.com/rules.php"
uri: qr{shareplace\.com/\?[0-9A-F]+(/.*)?}
uri: qr{shareplace\.org/\?[0-9A-F]+(/.*)?}
slots: max
status: OK 2010-07-14

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

start:
	GET( $-{_uri} );

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

	! m#Filename:</font></b>\s*(.*?)<b><br>\s*Filesize:</font></b>\s*($STDSIZE)<b>#so;
	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 beer = '(.*?)';#;
	my $beer = $1;
	$beer =~ s/vvvvvvvvv//;
	$beer =~ s/lllllllll//;
	my $sinep = uri_unescape( $beer );
	$sinep =~ s/teletubbies//;

	$-{file_uri} = substr uri_unescape( $sinep ), 13;

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

	CLICK_DOWNLOAD( $-{file_uri} );

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