Skip to content

Commit

Permalink
DOI Content Negotiation: Remove CrossRef outage workaround
Browse files Browse the repository at this point in the history
Outage is over.

Reverts 87bb5b2
  • Loading branch information
AbeJellinek committed Sep 27, 2024
1 parent 22fa76e commit f784fff
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions DOI Content Negotiation.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"priority": 100,
"inRepository": true,
"translatorType": 8,
"lastUpdated": "2024-09-14 20:03:55"
"lastUpdated": "2024-09-27 14:35:38"
}

/*
Expand Down Expand Up @@ -64,33 +64,6 @@ 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" } }
Expand Down

0 comments on commit f784fff

Please sign in to comment.