# $Id: SendSpacePL 11257 2010-03-12 02:56:59Z sparky $
# Get::SendSpacePL - 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: SendSpacePL
short: SS.pl
web: "http://www.sendspace.pl/"
tos: "http://www.sendspace.pl/informacje/regulamin"
uri: qr{sendspace\.pl/file/[a-zA-Z0-9]{8}}
cookie: ss.pl
status: OK 2010-03-12

start:
	GET( $-{_uri} );

	ERROR( "file not found" )
		if /Podany plik nie istnieje lub został usunięty./;

	! m#<div class="text"><span class="black3">Nazwa pliku:</span></div>\s*<div class="info"><span class="black3".*?><b>(.*?)</b></span></div>#s;
	my $name = $1;
	$name =~ s/\.\.\.$/\0/;

	! m#<div class="text"><span class="black3">Rozmiar pliku:</span></div>\s*<div class="info"><span class="blue4">([\d,]+ MB)</span></div>#s;
	my $size = $1;
	$size =~ s/,/\./;

	INFO( name => $name, asize => $size );

	! m#<a href="(http://www.sendspace.pl/download/.*?)"><img src=".*?" alt="Pobierz plik" title="Pobierz plik" /></a>#;
	my $file_uri = $1;

	CLICK_DOWNLOAD( $file_uri );

	RESTART( $1, "free limit reached" ) if /setDownloadTimeOut\('(\d+)'\);/;

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