- print STDERR "trying ".$link->url_abs()."..." if $DEBUG;
- my $r = $m->get($link->url_abs());
- if ($r->header('Content-Type') =~ /pdf/) {
- print STDERR "success\n" if $DEBUG;
- return $m;
- }
- print STDERR "failure; content type ".$r->header('Content-Type')."\n" if $DEBUG;
- print STDERR $m->content() if $DEBUG;
- }
- my @sub_frames = $m->find_all_links(tag_regex=>qr/^i?frame$/);
- for my $frame (@sub_frames) {
- my $r = $m->get($frame->url_abs());
- if ($r->header('Content-Type') =~ /pdf/) {
- return $m;
- }
- my $pdf_m = find_pdf_link($m,
- 0,
- $call+1,
- );
- if (defined $pdf_m) {
- return $pdf_m;
- }
+ print STDERR "trying ".$link->url_abs()."..." if $DEBUG;
+ my $r = $m->get($link->url_abs());
+ my $content = $m->content();
+ if ($r->header('Content-Type') =~ /pdf/) {
+ print STDERR "success\n" if $DEBUG;
+ return $m;
+ }
+ my $ret = check_subframes($m,$call);
+ return $ret if defined $ret;
+ print STDERR "failure; content type ".$r->header('Content-Type')."\n" if $DEBUG;
+ print STDERR $content if $DEBUG;