# $Id: ProtectLinks 11656 2010-07-12 01:58:33Z sparky $
# Link::ProtectLinks - Link decrypter 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: ProtectLinks
short: L:ProtectLinks
web: "http://protectlinks.com/"
tos: "http://protectlinks.com/tos.php"
uri: qr{protectlinks\.com/}
slots: max
status: OK 2010-07-12

start:
	$_ = $-{_uri};
	
	ERROR( "unsupported uri" )
		unless m#^(.*?com/)(redirect\.php\?id=)?(\d+)#;
	
	$-{_referer} = $1 . $3;

	GET( $1 . "redirect.php?id=" . $3 );

	ERROR( "Can't find link" )
		unless m#<iframe name="pagetext".*? src="\s*(.*?)\s*">#;

	LINK( $1 );

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