@harvestapi/scraper
Advanced tools
Comparing version
@@ -7,7 +7,9 @@ import { ScraperOptions } from './types'; | ||
constructor(options: ScraperOptions); | ||
fetchApi({ path, params, addHeaders, }: { | ||
fetchApi({ path, params, addHeaders, method, body, }: { | ||
path: string; | ||
params?: any; | ||
addHeaders?: Record<string, string>; | ||
method?: 'GET' | 'POST' | 'PUT' | 'DELETE'; | ||
body?: any; | ||
}): Promise<any>; | ||
} |
@@ -707,3 +707,3 @@ 'use strict'; | ||
} | ||
async fetchApi({ path, params, addHeaders, }) { | ||
async fetchApi({ path, params, addHeaders, method = 'GET', body, }) { | ||
var _a, _b; | ||
@@ -742,3 +742,3 @@ if (!this.options.apiKey) { | ||
const response = await fetch(apiUrl, { | ||
method: 'GET', | ||
method: method || 'GET', | ||
headers: { | ||
@@ -750,2 +750,3 @@ 'Content-Type': 'application/json', | ||
}, | ||
body: body ? JSON.stringify(body) : undefined, | ||
}).catch((e) => { | ||
@@ -1129,2 +1130,12 @@ this.logger.error('Error fetching API:', e); | ||
} | ||
async searchProfileEmail({ profile, ...params }) { | ||
return this.scraper.fetchApi({ | ||
path: 'linkedin/email-search-by-profile', | ||
params, | ||
method: 'POST', | ||
body: { | ||
profile, | ||
}, | ||
}); | ||
} | ||
async searchProfiles(params) { | ||
@@ -1131,0 +1142,0 @@ return this.scraper.fetchApi({ path: 'linkedin/profile-search', params }); |
@@ -705,3 +705,3 @@ import { randomUUID } from 'crypto'; | ||
} | ||
async fetchApi({ path, params, addHeaders, }) { | ||
async fetchApi({ path, params, addHeaders, method = 'GET', body, }) { | ||
var _a, _b; | ||
@@ -740,3 +740,3 @@ if (!this.options.apiKey) { | ||
const response = await fetch(apiUrl, { | ||
method: 'GET', | ||
method: method || 'GET', | ||
headers: { | ||
@@ -748,2 +748,3 @@ 'Content-Type': 'application/json', | ||
}, | ||
body: body ? JSON.stringify(body) : undefined, | ||
}).catch((e) => { | ||
@@ -1127,2 +1128,12 @@ this.logger.error('Error fetching API:', e); | ||
} | ||
async searchProfileEmail({ profile, ...params }) { | ||
return this.scraper.fetchApi({ | ||
path: 'linkedin/email-search-by-profile', | ||
params, | ||
method: 'POST', | ||
body: { | ||
profile, | ||
}, | ||
}); | ||
} | ||
async searchProfiles(params) { | ||
@@ -1129,0 +1140,0 @@ return this.scraper.fetchApi({ path: 'linkedin/profile-search', params }); |
@@ -15,2 +15,7 @@ import { ScraperOptions } from '../base'; | ||
}>>; | ||
searchProfileEmail({ profile, ...params }: BaseFetchParams & { | ||
profile: Partial<Profile>; | ||
}): Promise<ApiItemResponse<{ | ||
email?: string; | ||
}>>; | ||
searchProfiles(params: BaseFetchParams & SearchLinkedInProfilesParams): Promise<ApiListResponse<ProfileShort>>; | ||
@@ -17,0 +22,0 @@ getCompany(params: BaseFetchParams & GetLinkedinCompanyParams): Promise<ApiItemResponse<Company>>; |
{ | ||
"name": "@harvestapi/scraper", | ||
"version": "1.4.8", | ||
"version": "1.4.9", | ||
"main": "dist/index.cjs.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.esm.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
351535
0.81%3155
0.93%