Skip to content

Commit

Permalink
IngentaConnect: Fix PDF downloads
Browse files Browse the repository at this point in the history
The IC.identifier meta tag no longer contains the full identifier needed
for downloads, so use the download button directly or construct from the
main URL.

https://forums.zotero.org/discussion/97740/ingentaconnect-pdf-not-downloaded
  • Loading branch information
dstillman committed Jul 12, 2022
1 parent 0367773 commit 0dca2d8
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions IngentaConnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2020-02-20 21:11:47"
"lastUpdated": "2022-07-12 05:41:32"
}

/*
Expand Down Expand Up @@ -93,19 +93,18 @@ function getRisUrl(doc) {
}

function scrape(newDoc, url) {
var abs, pdf;
var abs;
var risurl = getRisUrl(newDoc);
if (ZU.xpathText(newDoc, '//div[@id="abstract"]')) {
abs = Zotero.Utilities.trimInternal(ZU.xpathText(newDoc, '//div[@id="abstract"]')).substr(10);
}
var articleID = ZU.xpathText(newDoc, '/html/head/meta[@name="IC.identifier"]/@content');
if (articleID) {
pdf = '/search/download?pub=infobike://' + articleID + '&mimetype=application/pdf';
}
else {
pdf = url.replace(/[?&#].*/, '')
var pdf = attr(newDoc, 'a.fulltext.pdf', 'data-popup');
if (!pdf) {
Z.debug("PDF URL not found - constructing from main URL");
pdf = url
.replace(/[?&#;].*/, '')
.replace('/content/', '/search/download?pub=infobike://')
+ '&mimetype=application/pdf';
+ '&mimetype=application/pdf&host=https://www.ingentaconnect.com';
}
if (ZU.xpathText(newDoc, '//div[@id="info"]/p[1]/a')) {
var keywords = ZU.xpathText(newDoc, '//div[@id="info"]/p[1]/a');
Expand Down

0 comments on commit 0dca2d8

Please sign in to comment.