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: add warning when we detect use of RL and RQ, but RQ is not provided explicitly (#2115)
Martin Adámek6fb1c5568a0b
diff --git a/packages/basic-crawler/src/internals/basic-crawler.ts b/packages/basic-crawler/src/internals/basic-crawler.tsindex aab11e3cb..6e0e27979 100644--- a/packages/basic-crawler/src/internals/basic-crawler.ts+++ b/packages/basic-crawler/src/internals/basic-crawler.ts@@ -902,6 +902,11 @@ export class BasicCrawler<Context extends CrawlingContext = BasicCrawlingContext}async getRequestQueue() {+ if (!this.requestQueue && this.requestList) {+ // eslint-disable-next-line max-len+ this.log.warningOnce('When using RequestList and RequestQueue at the same time, you should instantiate both explicitly and provide them in the crawler options, to ensure correctly handled restarts of the crawler.');+ }+this.requestQueue ??= await this._getRequestQueue();return this.requestQueue!;diff --git a/test/core/crawlers/browser_crawler.test.ts b/test/core/crawlers/browser_crawler.test.tsindex 98f7ff480..7684d57b9 100644--- a/test/core/crawlers/browser_crawler.test.ts+++ b/test/core/crawlers/browser_crawler.test.ts@@ -889,7 +889,9 @@ describe('BrowserCrawler', () => {await crawler.run([serverAddress]);expect(spy).toBeCalled();- expect(spy.mock.calls[0][0]).toEqual(expect.stringContaining(proxyError));+ // eslint-disable-next-line max-len+ expect(spy.mock.calls[0][0]).toEqual('When using RequestList and RequestQueue at the same time, you should instantiate both explicitly and provide them in the crawler options, to ensure correctly handled restarts of the crawler.');+ expect(spy.mock.calls[1][0]).toEqual(expect.stringContaining(proxyError));});});