From 1ed719ce9fbdefc64513493bf5c7b510f4281fe7 Mon Sep 17 00:00:00 2001 From: ION606 Date: Wed, 15 May 2024 09:33:41 -0700 Subject: [PATCH] fixed an incrementor bug --- classes/API.js | 4 ++-- classes/misc.js | 2 +- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/API.js b/classes/API.js index c6c5161..abdd0a7 100644 --- a/classes/API.js +++ b/classes/API.js @@ -209,13 +209,13 @@ export default class linkedInAPIClass { let urlExt = `variables=(start:${i},origin:GLOBAL_SEARCH_HEADER,query:(keywords:${keyword},flagshipSearchIntent:SEARCH_SRP,queryParameters:List((key:resultType,value:List(COMPANIES))${(numEmp) ? `,(key:companySize,value:List(${numsToSizes(...numEmp)}))` : ''}),includeFiltersInResponse:false))`; const r = await this._makeReq(urlExt); - if (this.logAll) lb.increment(); - if (!r?.included && r?.data?.errors) { console.error(JSON.stringify(r.data.errors)) throw "ERROR!"; } + if (this.logAll) lb.increment(Math.ceil(r.included.length / 10)); + if (!castToClass) compAll.push(r); else compAll.push(await parseResponse(r, this, excludeGeneric)); diff --git a/classes/misc.js b/classes/misc.js index 89d05c1..931701f 100644 --- a/classes/misc.js +++ b/classes/misc.js @@ -48,7 +48,7 @@ export class LoadingBar { } } - increment(amt) { + increment(amt = 1) { cursorTo(process.stdout, this.cursor); for (let i = 0; i < amt; i++) process.stdout.write("\u2588"); this.cursor += amt; diff --git a/package.json b/package.json index a9556ce..60d5c57 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "type": "module", "name": "linkedin-api-js", - "version": "1.0.0-15", + "version": "1.0.0-16", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1"