diff --git a/README.md b/README.md index 9f5abc8..74a85f3 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,6 @@ ## Usage ```bash -$ ./index.mjs | gzip - > data.json.gz - ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 0% | ETA: 17698s | 10000/1943464 +$ ./index.mjs | gzip - > data.json.gz + ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 0% | ETA: 104042s | 10000/1943464 ``` diff --git a/index.mjs b/index.mjs index 1f57a3d..0919e55 100755 --- a/index.mjs +++ b/index.mjs @@ -17,6 +17,7 @@ const bar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_grey); let afterKeyToken; +let errorPages = 0; console.log("[\n"); @@ -36,6 +37,7 @@ display(notices); const response = await fetch(`https://corhal-api.inist.fr/after/${afterKeyToken}`); if (response.status !== 200) { + errorPages += 1; continue; } notices = /** @type {object[]} */(await response.json()); @@ -49,3 +51,7 @@ display(notices, true); console.log("]\n"); + +if (errorPages) { + console.error(`There has been ${errorPages} pages in error!`); +}