Skip to content
Permalink
Browse files

arXiv: better xpath for id

  • Loading branch information...
adam3smith committed Apr 28, 2019
1 parent cea8902 commit b9d9cac82341b89d1c7c65b4b0db1a0600d51240
Showing with 3 additions and 3 deletions.
  1. +3 −3 arXiv.org.js
@@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 12,
"browserSupport": "gcsv",
"lastUpdated": "2019-04-20 11:32:16"
"lastUpdated": "2019-04-28 01:57:56"
}

/*
@@ -114,11 +114,10 @@ function doWeb(doc, url) {
id = url.substring(p + 5, url.length - 4);
}
else {
id = ZU.xpathText(doc, '//tr[td[text() = "Cite as:"]]//span[@class = "arxivid"]/a')
id = ZU.xpathText(doc, '(//span[@class="arxivid"]/a)[1]')
|| ZU.xpathText(doc, '//b[starts-with(normalize-space(text()),"arXiv:")]');
}
if (!id) throw new Error('Could not find arXiv ID on page.');

id = id.trim().replace(/^arxiv:\s*|v\d+|\s+.*$/ig, '');
var apiurl = 'http://export.arxiv.org/oai2?verb=GetRecord&metadataPrefix=oai_dc'
+ '&identifier=oai%3AarXiv.org%3A' + encodeURIComponent(id);
@@ -216,6 +215,7 @@ function parseXML(text) {
newItem.ISSN = item.ISSN;
if (item.publicationTitle) {
newItem.publicationTitle = item.publicationTitle;
newItem.journalAbbreviation = item.journalAbbreviation;
}
newItem.date = item.date;
});

0 comments on commit b9d9cac

Please sign in to comment.
You can’t perform that action at this time.