- my $aspx=0;
- while ($page=~m{<a href="([?]c=[^<>"]*&foto=[^<>"&]*(?:&inframe=1)?)"(?: target="foto-iframe")?>}gi) {
- my $relurl=$1;
- $relurl=~s{&}{&}g;
- my $frameurl=$BASE;
- $frameurl=~s{[?].*}{};
- $frameurl.=$relurl;
- my $frame=LWP::Simple::get($frameurl) or die $frameurl;
- if ($frame=~m{<iframe name="foto-iframe" id="foto-iframe" [^<>]* src="([?]c=[^<>"]*&inframe=1&[^<>"]*foto=[^<>"]*)">}) {
- $relurl=$1;
- $relurl=~s{&}{&}g;
- $frameurl=~s{[?].*}{};
- $frameurl.=$relurl;
- $frame=LWP::Simple::get($frameurl) or die $frameurl;
- }
- if ($frame!~m{<img\s+id="fotka"\s+alt="([^"]*)"\s+src="(http://\w+\Q.idnes.cz/\E[\d/]+)/(?:gal|cl6h|cl6)/([^<>"]+)" }is) {
-die $frame;
- last if !$did;
- die "No aspx image found: $frameurl";
- }
- $did=1;
- $aspx=1;
- my $text=$1;
- my $img_src="$2/org/$3";
- if (!LWP::Simple::head($img_src)) {
- $img_src="$2/maxi/$3";
- die $img_src if !LWP::Simple::head($img_src);
- }
- print <<"EOH";
-<hr>
-<img src="$img_src" border="0">
-EOH
- print <<"EOH" if !$seen_p_text{$text}++;
-<p>$text</p>
-EOH
- }
- while (!$aspx && $page=~m{<img src="http://(?:\Qi.idnes.cz\E/\d{2}/\d{3}|\Qimgs.idnes.cz\E/\w+)(?:/\w+)?/([-.\w]+.jpg)" }gi) {