diff --git a/DOI Content Negotiation.js b/DOI Content Negotiation.js index fa4e9a090b8..01a8abb2542 100644 --- a/DOI Content Negotiation.js +++ b/DOI Content Negotiation.js @@ -8,7 +8,7 @@ "priority": 100, "inRepository": true, "translatorType": 8, - "lastUpdated": "2023-09-22 09:54:11" + "lastUpdated": "2024-03-25 16:57:39" } /* @@ -64,18 +64,20 @@ async function doSearch(items) { } async function processDOI(doi) { - let response = await requestText( + let response = await request( `https://doi.org/${encodeURIComponent(doi)}`, { headers: { Accept: "application/vnd.datacite.datacite+json, application/vnd.crossref.unixref+xml, application/vnd.citationstyles.csl+json" } } ); + let { headers, body } = response; // by content negotiation we asked for datacite or crossref format, or CSL JSON - if (!response) return; - Z.debug(response); + if (!body) return; + Z.debug(body); let trans = Zotero.loadTranslator('import'); - trans.setString(response); + trans.setString(body); - if (response.includes("