Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ if (isActorStandby()) {
contentScraperSettings ${JSON.stringify(contentScraperSettings)}
`);

let stats = { requestsFinished: 0, requestsFailed: 0 };
try {
await handleSearchNormalMode(input, searchCrawlerOptions, contentCrawlerOptions, contentScraperSettings);
stats = await handleSearchNormalMode(input, searchCrawlerOptions, contentCrawlerOptions, contentScraperSettings);
} catch (e) {
const error = e as Error;
await Actor.fail(error.message as string);
}
await Actor.exit();
await Actor.exit(`Finished! Scraped ${stats.requestsFinished} pages, ${stats.requestsFailed} failed.`);
}
3 changes: 3 additions & 0 deletions src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,7 @@ export async function handleSearchNormalMode(input: Input,
log.info(`Running target page crawler with request: ${JSON.stringify(req)}`);
await contentCrawler!.run();
/* eslint-enable no-param-reassign */

const { requestsFinished, requestsFailed } = contentCrawler!.stats.state;
return { requestsFinished, requestsFailed };
}
Loading