Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
Make error message for backwards crawling more clear (#1758)
Micah Stairs4c1af8b96e51
diff --git a/apps/api/src/scraper/WebScraper/crawler.ts b/apps/api/src/scraper/WebScraper/crawler.tsindex 3fc7e9a3b..29450766f 100644--- a/apps/api/src/scraper/WebScraper/crawler.ts+++ b/apps/api/src/scraper/WebScraper/crawler.ts@@ -24,7 +24,7 @@ export enum DenialReason {ROBOTS_TXT = "URL blocked by robots.txt",FILE_TYPE = "URL points to a file type that is not crawled",URL_PARSE_ERROR = "URL could not be parsed",- BACKWARD_CRAWLING = "URL not allowed due to backward crawling restrictions",+ BACKWARD_CRAWLING = "URL cannot be crawled unless crawlEntireDomain is set to true",SOCIAL_MEDIA = "URL is a social media or email link",EXTERNAL_LINK = "External URL not allowed",SECTION_LINK = "URL contains section anchor (#)"@@ -288,7 +288,7 @@ export class WebCrawler {const delay = this.robots.getCrawlDelay("FireCrawlAgent") || this.robots.getCrawlDelay("FirecrawlAgent");this.robotsCrawlDelay = delay !== undefined ? delay : null;}-+public getRobotsCrawlDelay(): number | null {return this.robotsCrawlDelay;}@@ -425,11 +425,11 @@ export class WebCrawler {if (!this.noSections(fullUrl)) {return { allowed: false, denialReason: DenialReason.SECTION_LINK };}-+if (this.matchesExcludes(path)) {return { allowed: false, denialReason: DenialReason.EXCLUDE_PATTERN };}-+if (!this.isRobotsAllowed(fullUrl, this.ignoreRobotsTxt)) {(async () => {await redisEvictConnection.sadd(@@ -443,18 +443,18 @@ export class WebCrawler {})();return { allowed: false, denialReason: DenialReason.ROBOTS_TXT };}-+return { allowed: true, url: fullUrl };} else {// EXTERNAL LINKSif (this.isSocialMediaOrEmail(fullUrl)) {return { allowed: false, denialReason: DenialReason.SOCIAL_MEDIA };}-+if (this.matchesExcludes(fullUrl, true)) {return { allowed: false, denialReason: DenialReason.EXCLUDE_PATTERN };}-+if (this.isInternalLink(url) &&this.allowExternalContentLinks &&@@ -462,7 +462,7 @@ export class WebCrawler {) {return { allowed: true, url: fullUrl };}-+if (this.allowSubdomains &&!this.isSocialMediaOrEmail(fullUrl) &&@@ -470,7 +470,7 @@ export class WebCrawler {) {return { allowed: true, url: fullUrl };}-+return { allowed: false, denialReason: DenialReason.EXTERNAL_LINK };}}@@ -729,7 +729,7 @@ export class WebCrawler {try {const linkUrl = new URL(link);return linkUrl.hostname.endsWith(hostname);- } catch {}+ } catch { }}),);},