10 if (exists $ENV{"QUERY_STRING"}) {
11 $BASE=($ENV{"QUERY_STRING"}=~m{^url=([^&]*)})[0];
12 $BASE=URI::Escape::uri_unescape($BASE);
13 0==@ARGV or die "ARGV count != 0";
17 1==@ARGV or die "ARGV count != 1";
21 if ($ENV{"GATEWAY_INTERFACE"}) {
22 my $future=HTTP::Date::time2str(2000000000);
23 my $past =HTTP::Date::time2str(1000000000);
25 Content-type: text/html; charset=windows-1250
34 <title>iDNES foto@{[ (!$BASE ? "" : ": $BASE") ]}</title>
35 <meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
37 <form action="idnes-foto" method="get">
38 <input type="text" name="url" size="50" value="$BASE">
42 $BASE=~m{^http://\w+\Q.idnes.cz/foto.asp?\E(?:r=[-\w]+&c=[-\w]+|c=\w+&r=\w+)$} or $BASE="";
48 my $pageurl=$BASE.'&strana='.$pageno;
49 my $page=LWP::Simple::get($pageurl) or die $pageurl;
51 while ($page=~m{<img src="http://(?:\Qi.idnes.cz\E/\d{2}/\d{3}|\Qimgs.idnes.cz\E/\w+)(?:/\w+)?/([-.\w]+.jpg)" }gi) {
54 last PAGES if $seen{$base}++;
55 my $infourl=$BASE.'&styl=zoom&foto='.$base;
56 my $info=LWP::Simple::get($infourl) or die $infourl;
57 $info=~m{<img src="(http://(?:\Qi.idnes.cz\E/\d{2}/\d{3}|\Qimgs.idnes.cz\E/\w+)(?:/\w+)?/[-.\w]+.jpg)" }i
58 or die "No image found: $infourl";
62 <img src="$img_src" border="0">
64 my $text_last=keys(%seen_p_text);;
66 $info=~m{<p>([^<>]*)</p>},
67 $info=~m{<div class="text"><!--google_ad_section_start--><h4>([^<>]*)</h4><p>([^<>]*)<!--google_ad_section_end--></p><p>Autor:\s+(.*?)(?:, <a target="_blank" href="http://www.idnes.cz">iDNES.cz</a>)?</p></div>}s,
70 print <<"EOH" if !$seen_p_text{$text}++;
74 warn "No text found: $infourl" if $text_last==keys(%seen_p_text);
76 die $pageurl if !$did;