# $Id: ArchivTo 11673 2010-07-14 16:55:15Z sparky $
# Get::ArchivTo - 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.

# TODO: support video

name: ArchivTo
short: AT
web: "http://archiv.to/"
tos: "http://archiv.to/?Module=Policy"
uri: qr{archiv\.to/\?.*?HashID=FILE[0-9A-F]+}
uri: qr{archiv\.to/GET/FILE[0-9A-F]+}
slots: max
status: OK 2010-07-14

unify:
	return "http://archiv.to/GET/$1"
		if m{(FILE[0-9A-F]+)};

start:
	GET( $-{_uri} );

	ERROR( "file not found" )
		if /The desired file could not be found/;

	! m#>Originaldatei</td>\s*<td class="V">: <a href="(.*?)">(.*?)</a></td>#s;
	my ( $file_uri, $name ) = ( $1, $2 );

	! m#>Dateigröße</td>\s*<td class="V">: (\d+) Bytes #s;
	my $size = $1;

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

	CLICK_DOWNLOAD( de_ml( $file_uri ), fsize => $size );

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