]> git.donarmstrong.com Git - bin.git/commitdiff
be mozilla and add cookie jar
authorDon Armstrong <don@donarmstrong.com>
Wed, 1 Dec 2010 06:03:49 +0000 (06:03 +0000)
committerDon Armstrong <don@donarmstrong.com>
Wed, 1 Dec 2010 06:03:49 +0000 (06:03 +0000)
get_pdf

diff --git a/get_pdf b/get_pdf
index 74f62dc6998e1f6ec494b4411eac95f9495320d8..e5624546d22e39a67e1581fd621d6b10899e59fd 100755 (executable)
--- a/get_pdf
+++ b/get_pdf
@@ -108,7 +108,7 @@ if (exists $options{http_proxy}) {
 }
 
 if ($options{pmid}) {
-    my $m = WWW::Mechanize->new();
+    my $m = WWW::Mechanize->new(agent => 'Mozilla',cookie_jar => {});
     for my $pmid (@ARGV) {
        $pmid =~ s/\D//g;
        next unless length $pmid;
@@ -205,6 +205,7 @@ sub find_pdf_link {
            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) {