automated commit
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
"maxVersion": null,
|
||||
"priority": 100,
|
||||
"inRepository": true,
|
||||
"lastUpdated": "2024-05-17 20:25:00"
|
||||
"lastUpdated": "2024-09-14 20:20:00"
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -64,6 +64,33 @@ async function doSearch(items) {
|
||||
}
|
||||
|
||||
async function processDOI(doi) {
|
||||
// TEMP: Use Crossref REST for Crossref DOIs during Crossref 2024-09-16 outage
|
||||
let currentDate = new Date();
|
||||
let startDate = new Date(Date.UTC(2024, 8, 16, 20, 0, 0)); // 16 September 2024, 20:00 UTC (1 hour before outage)
|
||||
let endDate = new Date(Date.UTC(2024, 8, 17, 23, 0, 0)); // 17 September 2024, 23:00 UTC (2 hours after outage)
|
||||
if (currentDate >= startDate && currentDate <= endDate) {
|
||||
try {
|
||||
let raJSON = await requestJSON(
|
||||
`https://doi.org/ra/${encodeURIComponent(doi)}`
|
||||
);
|
||||
if (raJSON.length) {
|
||||
let ra = raJSON[0].RA;
|
||||
if (ra == 'Crossref') {
|
||||
let translate = Zotero.loadTranslator('search');
|
||||
// Crossref REST
|
||||
translate.setTranslator("0a61e167-de9a-4f93-a68a-628b48855909");
|
||||
let item = { itemType: "journalArticle", DOI: doi };
|
||||
translate.setSearch(item);
|
||||
translate.translate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
Z.debug(e);
|
||||
}
|
||||
}
|
||||
|
||||
let response = await requestText(
|
||||
`https://doi.org/${encodeURIComponent(doi)}`,
|
||||
{ headers: { Accept: "application/vnd.datacite.datacite+json, application/vnd.crossref.unixref+xml, application/vnd.citationstyles.csl+json" } }
|
||||
|
||||
Reference in New Issue
Block a user