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.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
fix: check `.isFinished()` before `RequestList` reads (#2695)
Jindřich Bär6fa170fbe16c
diff --git a/packages/basic-crawler/src/internals/basic-crawler.ts b/packages/basic-crawler/src/internals/basic-crawler.tsindex 435532158..ae94d8590 100644--- a/packages/basic-crawler/src/internals/basic-crawler.ts+++ b/packages/basic-crawler/src/internals/basic-crawler.ts@@ -1138,7 +1138,10 @@ export class BasicCrawler<Context extends CrawlingContext = BasicCrawlingContext* and RequestQueue is present then enqueues it to the queue first.*/protected async _fetchNextRequest() {- if (!this.requestList) return this.requestQueue!.fetchNextRequest();+ if (!this.requestList || (await this.requestList.isFinished())) {+ return this.requestQueue?.fetchNextRequest();+ }+const request = await this.requestList.fetchNextRequest();if (!this.requestQueue) return request;if (!request) return this.requestQueue.fetchNextRequest();