Only try 6 URLs from Unpaywall for a given DOI
Hard to imagine needing more than that many tries, and some DOIs appear to have a huge number of URLs by mistake.
This commit is contained in:
parent
7cf6634764
commit
d278437a81
1 changed files with 9 additions and 0 deletions
|
@ -957,6 +957,15 @@ Zotero.Utilities.Internal = {
|
||||||
Zotero.debug(`Found ${urls.length} open-access PDF ${Zotero.Utilities.pluralize(urls.length, ['URL', 'URLs'])}`);
|
Zotero.debug(`Found ${urls.length} open-access PDF ${Zotero.Utilities.pluralize(urls.length, ['URL', 'URLs'])}`);
|
||||||
// Handle older URL-only format
|
// Handle older URL-only format
|
||||||
urls = urls.map(o => typeof o == 'string' ? { url: o } : o);
|
urls = urls.map(o => typeof o == 'string' ? { url: o } : o);
|
||||||
|
|
||||||
|
// Only try a small number of URLs, and ignore Unpaywall rows that have a huge number of
|
||||||
|
// URLs by mistake (as of August 2018)
|
||||||
|
let maxURLs = 6;
|
||||||
|
if (urls.length > maxURLs) {
|
||||||
|
Zotero.debug(`Keeping ${maxURLs} URLs`);
|
||||||
|
urls = urls.slice(0, maxURLs);
|
||||||
|
}
|
||||||
|
|
||||||
return urls;
|
return urls;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue