# $Id: zSHARE 11716 2010-07-27 20:18:28Z sparky $
# Get::zSHARE - 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: zSHARE
short: zS
web: "http://zshare.net/"
tos: "http://zshare.net/TOS.html"
uri: qr{zshare\.net/(?:download|video)/[0-9a-f]+}
cookie: zs
slots: max
status: OK 2010-07-12

unify:
	return "http://zshare.net/download/$1"
		if m{zshare\.net/(?:download|video)/([0-9a-f]+)}

start:
	GET( $-{_uri} );

	ERROR( "file not found" ) if $-{_referer} =~ /file-404.html$/;

	! m{>File Name:\s*<font.*?>(.*?)</font></td>}s;
	my $name = $1;
	! m{>File Size:\s*<font.*?>($STDSIZE)</font></td>}so;
	INFO( name => $name, asize => $1 );

	! my $form = $self->form( name => "form1" );
	$form->set( "imageField.x" => irand 10, 190 );
	$form->set( "imageField.y" => irand 10, 37 );
	$form->set( "imageField" => "" );

	CLICK( $form->post() );

	! m{var link_enc=new Array\('(.*?)'\);};
	( $-{uri} = $1 ) =~ s/','//g;

	WAIT( 50, "starting download" );

	CLICK_DOWNLOAD( $-{uri} );

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