diff --git a/index.mjs b/index.mjs index a05abf8..1f57a3d 100755 --- a/index.mjs +++ b/index.mjs @@ -34,7 +34,10 @@ while (afterKeyToken && resultCount < max) { display(notices); - const response = await fetch("https://corhal-api.inist.fr/mergedDocuments?size=50"); + const response = await fetch(`https://corhal-api.inist.fr/after/${afterKeyToken}`); + if (response.status !== 200) { + continue; + } notices = /** @type {object[]} */(await response.json()); resultCount += notices.length; bar.update(resultCount);