# $Id: ImageShack 11277 2010-03-14 16:35:53Z sparky $
# Image::ImageShack - Image 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: ImageShack
short: I:ImageShack
web: "http://imageshack.us/"
tos: "http://reg.imageshack.us/content.php?page=rules"
uri: qr{profile\.imageshack\.us/user/.*?/images/detail/#\d+/.+}
uri: qr{(?:img\d+\.)imageshack\.us/i/.+/}
slots: max
status: OK 2010-03-11

unify:
	return "http://img$1.imageshack.us/i/$2/"
		if m{http://profile\.imageshack\.us/user/.*?/images/detail/#(\d+)/(.+)};

start:
	GET( $-{_uri} );

	! m{<a href="(.*?)" target="_blank".*class="last">\s*<img title="Zoom"};
	my $file_uri = de_ml( $1 );
	( my $fname = $file_uri ) =~ s{.*/}{};

	my $q = "image";
	$q = $1 if $fname =~ /\.(\S{1,5}?)$/;

	INFO( name => $fname, quality => $q );

	DOWNLOAD( $file_uri );

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