# $Id: ZippyShare 11297 2010-04-03 00:32:29Z sparky $
# Get::ZippyShare - File getter plugin for rsget.pl
#
# 2010 (c) Paweł Zuzelski <pawelz@pld-linux.org>
#		This program is free software,
# you may distribute it under GPL v2 or newer.

name: ZippyShare
short: ZipS
web: "http://www.zippyshare.com/"
tos: "http://www.zippyshare.com/terms.html"
uri: qr{(?:www\d*\.)?zippyshare\.com/v/\d+/file\.}
cookie: zips
slots: max
status: OK 2010-04-03

unify:
	return "$1/file.html" if m{^(.*?)/file};

start:
	GET( $-{_uri} );

	ERROR( "file not found" ) if m{<title>.*?- File does not exist</title>};

	! m#<strong>Name: </strong>(.+?)<#;
	my $name = $1;
	! m#<strong>Size: </strong>($STDSIZE)<#;
	INFO( name => $name, asize => $1 );

	! m#var ziptime = (\d+); tuw\(\);#s;
	my $wait = $1;

	! m#var pong = '(.*?)';#;
	$-{file_uri} = uri_unescape( $1 );
	$-{file_uri} =~ s/\.\S+?\./.zippyshare./g;

	WAIT( $wait, "starting download" );

	CLICK_DOWNLOAD( $-{file_uri} );

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