Skip to content

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.

docs: clarify `run()` resolve condition (#2847)

Matouš Maříkad6fcd4a6c7d
diff --git a/packages/basic-crawler/src/internals/basic-crawler.ts b/packages/basic-crawler/src/internals/basic-crawler.ts
index 25fc29909..79439857c 100644
--- a/packages/basic-crawler/src/internals/basic-crawler.ts
+++ b/packages/basic-crawler/src/internals/basic-crawler.ts
@@ -860,12 +860,14 @@ export class BasicCrawler<Context extends CrawlingContext = BasicCrawlingContext
}
/**
- * Runs the crawler. Returns a promise that gets resolved once all the requests are processed.
- * We can use the `requests` parameter to enqueue the initial requests - it is a shortcut for
- * running {@apilink BasicCrawler.addRequests|`crawler.addRequests()`} before the {@apilink BasicCrawler.run|`crawler.run()`}.
+ * Runs the crawler. Returns a promise that resolves once all the requests are processed
+ * and `autoscaledPool.isFinished` returns `true`.
*
- * @param [requests] The requests to add
- * @param [options] Options for the request queue
+ * We can use the `requests` parameter to enqueue the initial requests — it is a shortcut for
+ * running {@apilink BasicCrawler.addRequests|`crawler.addRequests()`} before {@apilink BasicCrawler.run|`crawler.run()`}.
+ *
+ * @param [requests] The requests to add.
+ * @param [options] Options for the request queue.
*/
async run(requests?: (string | Request | RequestOptions)[], options?: CrawlerRunOptions): Promise<FinalStatistics> {
if (this.running) {