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.

fix: return true when robots.isAllowed returns undefined (#2439)

Gigino Chianese6f541f8c4ea9
diff --git a/packages/utils/src/internals/robots.ts b/packages/utils/src/internals/robots.ts
index fd390dd7a..89d6b9650 100644
--- a/packages/utils/src/internals/robots.ts
+++ b/packages/utils/src/internals/robots.ts
@@ -83,7 +83,7 @@ export class RobotsFile {
* @param [userAgent] relevant user agent, default to `*`
*/
isAllowed(url: string, userAgent = '*'): boolean {
- return this.robots.isAllowed(url, userAgent) ?? false;
+ return this.robots.isAllowed(url, userAgent) ?? true; // `undefined` means that there is no explicit rule for the requested URL - assume it's allowed
}
/**