X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=public_html%2Fcgi-bin%2Fidnes-foto;h=6ead9ce247f7ba64ea3fe09f754cfc5ef32eef00;hp=2cd8e7325d1828b9d1b25fa9dfb0647bfd026ef4;hb=e2bfa49144d1f2f6c39eabf4988c50e4aed1aae0;hpb=24d7f898e5d6e1b5b33730901c3ef678dfad4c2a
diff --git a/public_html/cgi-bin/idnes-foto b/public_html/cgi-bin/idnes-foto
index 2cd8e73..6ead9ce 100755
--- a/public_html/cgi-bin/idnes-foto
+++ b/public_html/cgi-bin/idnes-foto
@@ -41,7 +41,30 @@ print <<"EOH";
EOH
-$BASE=~m{^http://\w+\Q.idnes.cz/foto.asp?\E(?:r=[-_\w]+&c=[-_\w]+|c=[-_\w]+&r=[-_\w]+)$} or $BASE="";
+$BASE=~m{^http://\w+\Q.idnes.cz/foto.asp\Ex?[?](?:r=[-_\w]+&c=[-_\w]+|c=[-_\w]+&r=[-_\w]+)$} or $BASE="";
+
+
+my $ua=LWP::UserAgent->new();
+$ua->env_proxy();
+$ua->requests_redirectable([]);
+
+#sub webget($)
+#{
+# my($url)=@_;
+#
+# my $resp=$ua->get($url);
+# if ($resp->is_redirect()) {
+# my $relurl=$resp->header("Location");
+# $relurl=~m{^foto.*[?]} or die;
+# $url=~s{[^/]*$}{};
+# $url.=$relurl;
+# warn "Redirect to: $url\n";
+# $resp=$ua->get($url);
+# }
+# $resp->is_success() or die $url;
+# return $resp->decoded_content();
+#}
+
if ($BASE) {
my $pageno=1;
my %seen;
@@ -50,7 +73,43 @@ PAGES: for (;;) {
my $pageurl=$BASE.'&strana='.$pageno;
my $page=LWP::Simple::get($pageurl) or die $pageurl;
my $did=0;
- while ($page=~m{"&]*(?:&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{