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: make the `Request` constructor options typesafe (#2034)
Martin Adámek75e7d6554a18
diff --git a/packages/core/src/request.ts b/packages/core/src/request.tsindex 675c53a1c..60a3b922b 100644--- a/packages/core/src/request.ts+++ b/packages/core/src/request.ts@@ -132,7 +132,7 @@ export class Request<UserData extends Dictionary = Dictionary> {/*** `Request` parameters including the URL, HTTP method and headers, and others.*/- constructor(options: RequestOptions) {+ constructor(options: RequestOptions<UserData>) {ow(options, 'RequestOptions', ow.object);ow(options.url, 'RequestOptions.url', ow.string);// 'ow' validation is slow, because it checks all predicatesdiff --git a/test/core/storages/request_queue.test.ts b/test/core/storages/request_queue.test.tsindex c19050e16..6783e4aea 100644--- a/test/core/storages/request_queue.test.ts+++ b/test/core/storages/request_queue.test.ts@@ -691,7 +691,7 @@ describe('RequestQueue remote', () => {const r2 = new Request({url,method,- userData: {},+ userData: {} as any,});const r3 = new Request({url,