Skip to content
Permalink
Browse files

Extend semantic scholar to work from pdf

  • Loading branch information...
GuyAglionby committed Mar 30, 2019
1 parent aaa5484 commit 86658205033adab80ce5de464d6cdfd6f96fe281
Showing with 9 additions and 2 deletions.
  1. +9 −2 Semantic Scholar.js
@@ -2,14 +2,14 @@
"translatorID": "276cb34c-6861-4de7-a11d-c2e46fb8af28",
"label": "Semantic Scholar",
"creator": "Guy Aglionby",
"target": "^https?://(www[.])?semanticscholar\\.org/(search|paper|author)",
"target": "^https?://(www\\.semanticscholar\\.org/(search|paper|author)|pdfs\\.semanticscholar\\.org/)",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2019-03-30 15:55:54"
"lastUpdated": "2019-03-30 16:44:44"
}

/*
@@ -45,6 +45,8 @@ var bibtex2zoteroTypeMap = {
function detectWeb(doc, url) {
if (url.includes('/search') || url.includes('/author/')) {
return 'multiple';
} else if (url.includes('pdfs.semanticscholar.org')) {
return 'journalArticle';
} else {
let citation = ZU.xpathText(doc, '//pre[@class="bibtex-citation"]');
let type = citation.split('{')[0].replace('@', '');
@@ -59,6 +61,11 @@ function doWeb(doc, url) {
ZU.processDocuments(Object.keys(selected), parseDocument);
}
});
} else if (url.includes('pdfs.semanticscholar.org')) {
let urlComponents = url.split('/');
let paperId = urlComponents[3] + urlComponents[4].replace('.pdf', '');
const API_URL = 'https://api.semanticscholar.org/';
ZU.processDocuments(API_URL + paperId, parseDocument);
} else {
parseDocument(doc, url);
}

0 comments on commit 8665820

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