#!/usr/bin/perl use CGI; $cgi = new CGI; if (defined($cgi->param("slideshow"))) { print "Location: movie.pl?$ENV{'QUERY_STRING'}\n\n"; exit; } $panbase = "http://www.amazon.com/gp/yp/snapshot/pan.html/?snapshot="; $a9 = $cgi->param("url"); # || "http://www.amazon.com/gp/product/B0004CHJV2/102-0306354-8911335?"; $origid = $cgi->param("id") || "0f5861031b445205"; $size = $cgi->param("size") || "med"; $dir = $cgi->param("dir") || "right"; #if ($origid eq "0f5861031b445205") { # $origid = "3026994299653c3365e5ef693e7e395e"; #} if (defined($a9)) { open(WGET,"wget -U \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)\" -q -O - $a9|"); while () { if ($_ =~ /^snapImages\[3\] \= \{ id: '(.*?)'/) { $origid = $1; break; } } close(WGET); } if ($dir eq "right") { $| = 1; } $id = $origid; print "Content-type: text/html\n\n"; print ""; while ($id ne "") { $images = ""; $left = ""; $right = ""; open(WGET,"wget -U \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)\" -q -O - $panbase$id|"); while () { if ($_ =~ /thumb: '(.*?)'.*?view: '(.*?)'/) { if ($size eq "med") { $img = $2; } else { $img = $1; } #if ($dir eq "right") { $images .= "\n"; #} else { # $images = "\n" . $images; #} } elsif ($_ =~ /'(.*?)'.*?'(.*?)'.*?'(.*?)'/) { $left = $2; $right = $3; } } close(WGET); if ($dir eq "right") { print $images; } else { $leftimages = $images . $leftimages;; } if ($dir eq "right") { $id = $right; } else { $id = $left; } } if ($dir eq "left") { print $leftimages; } print "";