company size fix

This commit is contained in:
2024-05-10 13:50:31 -07:00
parent 179cf8fd2d
commit 3e34969d38
3 changed files with 7 additions and 5 deletions
+2 -2
View File
@@ -72,7 +72,7 @@ function findRangeIndex(number) {
for (let i = 0; i < companySizeRanges.length; i++) {
const [lowerBound, upperBound] = companySizeRanges[i];
if (number >= lowerBound && number <= upperBound) {
return `"${rangeMap[i]}"`;
return rangeMap[i];
}
}
@@ -196,7 +196,7 @@ export default class linkedInAPIClass {
* @returns {Promise<[SocialActivityCounts | Group | Company | GenericEntity]>}
*/
async searchCompanies(keyword, numEmp = undefined, start = 0, castToClass = true, excludeGeneric = false) {
let urlExt = `variables=(start:${start},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))`;
let urlExt = `variables=(start:${start},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 (!r?.included && r?.data?.errors) {
+1 -1
View File
@@ -7,7 +7,7 @@
},
"type": "module",
"name": "linkedin-api-js",
"version": "1.0.0-6",
"version": "1.0.0-7",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
+4 -2
View File
@@ -7,8 +7,10 @@ import fs from 'fs';
const o = JSON.parse(fs.readFileSync('config.json'));
await LAPI.login(o.email, o.password);
const c = await LAPI.searchCompanies('microsoft', undefined, 0, true, true);
const c = await LAPI.searchCompanies('microsoft', [10, 500, 5000], 0, true, true);
console.log(c);
const managers = await c.find(o => (o.name === 'Microsoft')).searchEmployees('manager', 5);
console.log(managers, managers.length);
})();undefined
})();