@harvestapi/scraper
Advanced tools
Comparing version
@@ -976,3 +976,3 @@ 'use strict'; | ||
this.stats.items++; | ||
if (this.scrapedItems[item.id]) { | ||
if (!(item === null || item === void 0 ? void 0 : item.id) || this.scrapedItems[item.id]) { | ||
return; | ||
@@ -1098,2 +1098,5 @@ } | ||
} | ||
async getPostReactions(params) { | ||
return this.scraper.fetchApi({ path: 'linkedin/post-reactions', params }); | ||
} | ||
async searchCompanyAssociatedProfiles(params) { | ||
@@ -1163,2 +1166,14 @@ return this.scraper.fetchApi({ | ||
} | ||
async scrapePostReactions({ query, ...options }) { | ||
return new ListingScraper({ | ||
fetchList: ({ page }) => this.getPostReactions({ ...query, page }), | ||
fetchItem: async ({ item }) => (item === null || item === void 0 ? void 0 : item.id) | ||
? { entityId: item === null || item === void 0 ? void 0 : item.id, element: item } | ||
: { skipped: true }, | ||
scrapeDetails: false, | ||
entityName: 'post-reactions', | ||
...options, | ||
maxPages: 100, | ||
}).scrapeStart(); | ||
} | ||
async test() { | ||
@@ -1165,0 +1180,0 @@ return this.scraper.fetchApi({ path: 'linkedin/test' }); |
@@ -974,3 +974,3 @@ import { randomUUID } from 'crypto'; | ||
this.stats.items++; | ||
if (this.scrapedItems[item.id]) { | ||
if (!(item === null || item === void 0 ? void 0 : item.id) || this.scrapedItems[item.id]) { | ||
return; | ||
@@ -1096,2 +1096,5 @@ } | ||
} | ||
async getPostReactions(params) { | ||
return this.scraper.fetchApi({ path: 'linkedin/post-reactions', params }); | ||
} | ||
async searchCompanyAssociatedProfiles(params) { | ||
@@ -1161,2 +1164,14 @@ return this.scraper.fetchApi({ | ||
} | ||
async scrapePostReactions({ query, ...options }) { | ||
return new ListingScraper({ | ||
fetchList: ({ page }) => this.getPostReactions({ ...query, page }), | ||
fetchItem: async ({ item }) => (item === null || item === void 0 ? void 0 : item.id) | ||
? { entityId: item === null || item === void 0 ? void 0 : item.id, element: item } | ||
: { skipped: true }, | ||
scrapeDetails: false, | ||
entityName: 'post-reactions', | ||
...options, | ||
maxPages: 100, | ||
}).scrapeStart(); | ||
} | ||
async test() { | ||
@@ -1163,0 +1178,0 @@ return this.scraper.fetchApi({ path: 'linkedin/test' }); |
import { ScraperOptions } from '../base'; | ||
import { ApiItemResponse, ApiListResponse } from '../types'; | ||
import { Company, CompanyShort, GetLinkedinCompanyParams, GetLinkedinJobParams, GetLinkedInProfileParams, Job, JobShort, PostShort, Profile, ProfileShort, ScrapeLinkedinCompaniesParams, ScrapeLinkedinJobsParams, ScrapeLinkedinPostsParams, ScrapeLinkedinProfilesParams, SearchLinkedinCompaniesParams, SearchLinkedInCompanyAssociatedProfilesParams, SearchLinkedinJobsParams, SearchLinkedinPostsParams, SearchLinkedInProfilesParams, SearchLinkedInProfilesParamsV2 } from './types'; | ||
import { Company, CompanyShort, GetLinkedinCompanyParams, GetLinkedinJobParams, GetLinkedinPostReactionsParams, GetLinkedInProfileParams, Job, JobShort, PostReaction, PostShort, Profile, ProfileShort, ScrapeLinkedinCompaniesParams, ScrapeLinkedinJobsParams, ScrapeLinkedinPostReactionsParams, ScrapeLinkedinPostsParams, ScrapeLinkedinProfilesParams, SearchLinkedinCompaniesParams, SearchLinkedInCompanyAssociatedProfilesParams, SearchLinkedinJobsParams, SearchLinkedinPostsParams, SearchLinkedInProfilesParams, SearchLinkedInProfilesParamsV2 } from './types'; | ||
export declare class LinkedinScraper { | ||
@@ -22,2 +22,3 @@ private options; | ||
searchPosts(params: SearchLinkedinPostsParams): Promise<ApiListResponse<PostShort>>; | ||
getPostReactions(params: GetLinkedinPostReactionsParams): Promise<ApiListResponse<PostReaction>>; | ||
searchCompanyAssociatedProfiles(params: SearchLinkedInCompanyAssociatedProfilesParams): Promise<ApiListResponse<ProfileShort>>; | ||
@@ -64,3 +65,11 @@ scrapeJobs({ query, ...options }: ScrapeLinkedinJobsParams): Promise<{ | ||
} | undefined>; | ||
scrapePostReactions({ query, ...options }: ScrapeLinkedinPostReactionsParams): Promise<{ | ||
pages: number; | ||
pagesSuccess: number; | ||
items: number; | ||
itemsSuccess: number; | ||
requests: number; | ||
requestsStartTime: Date; | ||
} | undefined>; | ||
test(): Promise<any>; | ||
} |
@@ -93,2 +93,6 @@ import { ListingScraperConfig } from '../base'; | ||
} | ||
export interface GetLinkedinPostReactionsParams { | ||
post: string | number; | ||
page?: number; | ||
} | ||
export type Profile = { | ||
@@ -444,2 +448,18 @@ id: string; | ||
}; | ||
export type PostReaction = { | ||
id: string; | ||
reactionType: string; | ||
actor: { | ||
id: string; | ||
name: string; | ||
linkedinUrl: string; | ||
position: string; | ||
image: { | ||
url: string; | ||
width: number; | ||
height: number; | ||
expiresAt: number; | ||
}; | ||
}; | ||
}; | ||
export type ScrapeLinkedinJobsParams = { | ||
@@ -458,2 +478,5 @@ query: SearchLinkedinJobsParams; | ||
} & ListingScraperConfig<PostShort, PostShort>; | ||
export type ScrapeLinkedinPostReactionsParams = { | ||
query: GetLinkedinPostReactionsParams; | ||
} & ListingScraperConfig<PostReaction, PostReaction>; | ||
export type ErrorResponse = { | ||
@@ -460,0 +483,0 @@ error: string; |
{ | ||
"name": "@harvestapi/scraper", | ||
"version": "1.3.9", | ||
"version": "1.3.10", | ||
"main": "dist/index.cjs.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.esm.js", |
110
README.md
@@ -218,2 +218,16 @@ # HarvestAPI scraping tools | ||
##### getPostReactions() | ||
> **getPostReactions**(`params`): `Promise`\<[`ApiListResponse`](#apilistresponsetitem)\<[`PostReaction`](#postreaction)\>\> | ||
###### Parameters | ||
###### params | ||
[`GetLinkedinPostReactionsParams`](#getlinkedinpostreactionsparams) | ||
###### Returns | ||
`Promise`\<[`ApiListResponse`](#apilistresponsetitem)\<[`PostReaction`](#postreaction)\>\> | ||
##### searchCompanyAssociatedProfiles() | ||
@@ -303,2 +317,16 @@ | ||
##### scrapePostReactions() | ||
> **scrapePostReactions**(`__namedParameters`): `Promise`\<`undefined` \| \{ `pages`: `number`; `pagesSuccess`: `number`; `items`: `number`; `itemsSuccess`: `number`; `requests`: `number`; `requestsStartTime`: `Date`; \}\> | ||
###### Parameters | ||
###### \_\_namedParameters | ||
[`ScrapeLinkedinPostReactionsParams`](#scrapelinkedinpostreactionsparams) | ||
###### Returns | ||
`Promise`\<`undefined` \| \{ `pages`: `number`; `pagesSuccess`: `number`; `items`: `number`; `itemsSuccess`: `number`; `requests`: `number`; `requestsStartTime`: `Date`; \}\> | ||
## Interfaces | ||
@@ -632,2 +660,16 @@ | ||
### GetLinkedinPostReactionsParams | ||
#### Properties | ||
##### post | ||
> **post**: `string` \| `number` | ||
##### page? | ||
> `optional` **page**: `number` | ||
*** | ||
### BaseApiResponse | ||
@@ -1717,2 +1759,58 @@ | ||
### PostReaction | ||
> **PostReaction**: `object` | ||
#### Type declaration | ||
##### id | ||
> **id**: `string` | ||
##### reactionType | ||
> **reactionType**: `string` | ||
##### actor | ||
> **actor**: `object` | ||
###### actor.id | ||
> **id**: `string` | ||
###### actor.name | ||
> **name**: `string` | ||
###### actor.linkedinUrl | ||
> **linkedinUrl**: `string` | ||
###### actor.position | ||
> **position**: `string` | ||
###### actor.image | ||
> **image**: `object` | ||
###### actor.image.url | ||
> **url**: `string` | ||
###### actor.image.width | ||
> **width**: `number` | ||
###### actor.image.height | ||
> **height**: `number` | ||
###### actor.image.expiresAt | ||
> **expiresAt**: `number` | ||
*** | ||
### ScrapeLinkedinJobsParams | ||
@@ -1770,2 +1868,14 @@ | ||
### ScrapeLinkedinPostReactionsParams | ||
> **ScrapeLinkedinPostReactionsParams**: `object` & [`ListingScraperConfig`](#listingscraperconfigtitemshot-titemdetails)\<[`PostReaction`](#postreaction), [`PostReaction`](#postreaction)\> | ||
#### Type declaration | ||
##### query | ||
> **query**: [`GetLinkedinPostReactionsParams`](#getlinkedinpostreactionsparams) | ||
*** | ||
### ErrorResponse | ||
@@ -1772,0 +1882,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
302786
2.69%27
3.85%2807
2.33%1929
6.05%