]> git.donarmstrong.com Git - bin.git/blobdiff - get_pdf
* add tex-only optino
[bin.git] / get_pdf
diff --git a/get_pdf b/get_pdf
index 3768e5217970af5e4410e527b23b21c9763b0e01..745ea9aedec558b4ddea088c70784c2013f5dd15 100755 (executable)
--- a/get_pdf
+++ b/get_pdf
@@ -150,7 +150,7 @@ if ($options{pmid}) {
        };
        if ($@) {
            print STDERR "$@\n" if $DEBUG;
-           system('links',
+           system('links2',
                   exists $options{http_proxy}?('-http-proxy',$options{http_proxy}):(),
                   $url
                  ) == 0 or next;
@@ -178,6 +178,8 @@ sub find_pdf_link {
        print STDERR $m->content() if $DEBUG;
     }
     my @possible_links;
+    # this is to prioritize the real link at science direct
+    push @possible_links, grep { $_->url_abs() !~ /_orig=article/} $m->find_all_links(text_regex => qr/PDF/i);
     push @possible_links, $m->find_all_links(tag_regex => qr/meta/,
                                             url_regex  => qr/(reprint|\.pdf)/i,
                                            );