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
chore: throw different error if user accidentally imports enqueueLinks (#1681)
Vlad Frangu3692b1104632
diff --git a/packages/core/src/enqueue_links/enqueue_links.ts b/packages/core/src/enqueue_links/enqueue_links.tsindex 13e1ffff1..3e42c4672 100644--- a/packages/core/src/enqueue_links/enqueue_links.ts+++ b/packages/core/src/enqueue_links/enqueue_links.ts@@ -166,6 +166,14 @@ export enum EnqueueStrategy {* @returns Promise that resolves to {@apilink BatchAddRequestsResult} object.*/export async function enqueueLinks(options: SetRequired<EnqueueLinksOptions, 'requestQueue' | 'urls'>): Promise<BatchAddRequestsResult> {+ if (!options || Object.keys(options).length === 0) {+ throw new RangeError([+ // eslint-disable-next-line max-len+ 'enqueueLinks() was called without the required options. You can only do that when you use the `crawlingContext.enqueueLinks()` method in request handlers.',+ 'Check out our guide on how to use enqueueLinks() here: https://crawlee.dev/docs/examples/crawl-relative-links',+ ].join('\n'));+ }+ow(options, ow.object.exactShape({urls: ow.array.ofType(ow.string),requestQueue: ow.object.hasKeys('fetchNextRequest', 'addRequest'),