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
Better logging of timeouts in crawlers
Jan Curn995f6446fc61
diff --git a/src/crawlers/basic_crawler.js b/src/crawlers/basic_crawler.jsindex 5d13d44d8..76887e5e4 100644--- a/src/crawlers/basic_crawler.js+++ b/src/crawlers/basic_crawler.js@@ -349,7 +349,7 @@ class BasicCrawler {await addTimeoutToPromise(this.handleRequestFunction({ request, autoscaledPool: this.autoscaledPool }),this.handleRequestTimeoutMillis,- 'BasicCrawler: handleRequestFunction timed out.',+ `BasicCrawler: handleRequestFunction timed out after ${this.handleRequestTimeoutMillis / 1000} seconds.`,);await source.markRequestHandled(request);this.stats.finishJob(statisticsId);diff --git a/src/crawlers/cheerio_crawler.js b/src/crawlers/cheerio_crawler.jsindex e9afcda34..b26b06d6a 100644--- a/src/crawlers/cheerio_crawler.js+++ b/src/crawlers/cheerio_crawler.js@@ -354,7 +354,7 @@ class CheerioCrawler {return addTimeoutToPromise(this.handlePageFunction(context),this.handlePageTimeoutMillis,- 'CheerioCrawler: handlePageFunction timed out.',+ `CheerioCrawler: handlePageFunction timed out after ${this.handlePageTimeoutMillis / 1000} seconds.`,);}diff --git a/src/crawlers/puppeteer_crawler.js b/src/crawlers/puppeteer_crawler.jsindex 0eadba9f7..1e339556d 100644--- a/src/crawlers/puppeteer_crawler.js+++ b/src/crawlers/puppeteer_crawler.js@@ -292,7 +292,7 @@ class PuppeteerCrawler {await addTimeoutToPromise(this.handlePageFunction({ page, request, autoscaledPool, puppeteerPool: this.puppeteerPool, response }),this.handlePageTimeoutMillis,- 'PuppeteerCrawler: handlePageFunction timed out.',+ `PuppeteerCrawler: handlePageFunction timed out after ${this.handlePageTimeoutMillis / 1000} seconds.`,);} finally {await this.puppeteerPool.recyclePage(page);