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
[Bug] Fixing /crawl limit
rafaelsideguidebc6b929b43ff
diff --git a/apps/api/src/scraper/WebScraper/crawler.ts b/apps/api/src/scraper/WebScraper/crawler.tsindex 0248df256..1b371fdc3 100644--- a/apps/api/src/scraper/WebScraper/crawler.ts+++ b/apps/api/src/scraper/WebScraper/crawler.ts@@ -25,7 +25,7 @@ export class WebCrawler {initialUrl,includes,excludes,- maxCrawledLinks,+ maxCrawledLinks = 10000,limit = 10000,generateImgAltText = false,maxCrawledDepth = 10,@@ -136,7 +136,7 @@ export class WebCrawler {inProgress?: (progress: Progress) => void): Promise<string[]> {const queue = async.queue(async (task: string, callback) => {- if (this.crawledUrls.size >= this.maxCrawledLinks) {+ if (this.crawledUrls.size >= Math.min(this.maxCrawledLinks, this.limit)) {if (callback && typeof callback === "function") {callback();}@@ -147,14 +147,14 @@ export class WebCrawler {if (inProgress && newUrls.length > 0) {inProgress({current: this.crawledUrls.size,- total: this.maxCrawledLinks,+ total: Math.min(this.maxCrawledLinks, this.limit),status: "SCRAPING",currentDocumentUrl: newUrls[newUrls.length - 1],});} else if (inProgress) {inProgress({current: this.crawledUrls.size,- total: this.maxCrawledLinks,+ total: Math.min(this.maxCrawledLinks, this.limit),status: "SCRAPING",currentDocumentUrl: task,});