Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

fix: destructure `CrawlerRunOptions` before passing them to `addRequests` (#2803)

Jindřich Bär02a598c2a501
diff --git a/packages/basic-crawler/src/internals/basic-crawler.ts b/packages/basic-crawler/src/internals/basic-crawler.ts
index f091ac212..b562ff4f6 100644
--- a/packages/basic-crawler/src/internals/basic-crawler.ts
+++ b/packages/basic-crawler/src/internals/basic-crawler.ts
@@ -874,7 +874,7 @@ export class BasicCrawler<Context extends CrawlingContext = BasicCrawlingContext
);
}
- const purgeRequestQueue = options?.purgeRequestQueue ?? true;
+ const { purgeRequestQueue = true, ...addRequestsOptions } = options ?? {};
if (this.hasFinishedBefore) {
// When executing the run method for the second time explicitly,
@@ -896,7 +896,7 @@ export class BasicCrawler<Context extends CrawlingContext = BasicCrawlingContext
await purgeDefaultStorages({ onlyPurgeOnce: true });
if (requests) {
- await this.addRequests(requests, options);
+ await this.addRequests(requests, addRequestsOptions);
}
await this._init();