# $Id: SendSpacePL 10867 2009-10-26 22:47:10Z sparky $
# Get::SendSpacePL - 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: SendSpacePL
short: SS.pl
uri: qr{sendspace\.pl/file/[a-zA-Z0-9]{8}}
cookie: ss.pl
status: OK 2009-10-23

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
