Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Fix bug which sometimes caused crawl to only return 1 result (#1810)

Micah Stairsa30af244964b
diff --git a/apps/api/src/scraper/WebScraper/crawler.ts b/apps/api/src/scraper/WebScraper/crawler.ts
index 67ff04442..390bf81e4 100644
--- a/apps/api/src/scraper/WebScraper/crawler.ts
+++ b/apps/api/src/scraper/WebScraper/crawler.ts
@@ -144,36 +144,37 @@ export class WebCrawler {
return { links: sitemapLinks.slice(0, limit), denialReasons };
}
- try {
- const res = await filterLinks({
- links: sitemapLinks,
- limit: isFinite(limit) ? limit : undefined,
- max_depth: maxDepth,
- base_url: this.baseUrl,
- initial_url: this.initialUrl,
- regex_on_full_url: this.regexOnFullURL,
- excludes: this.excludes,
- includes: this.includes,
- allow_backward_crawling: this.allowBackwardCrawling,
- ignore_robots_txt: this.ignoreRobotsTxt,
- robots_txt: this.robotsTxt,
- });
-
- const fancyDenialReasons = new Map<string, string>();
- res.denial_reasons.forEach((value, key) => {
- fancyDenialReasons.set(key, DenialReason[value]);
- });
-
- return {
- links: res.links,
- denialReasons: fancyDenialReasons,
- };
- } catch (error) {
- this.logger.error("Error filtering links in Rust, falling back to JS", {
- error,
- method: "filterLinks",
- });
- }
+ // NOTE: Temporarily disabling this until we fix the issue with it only returning 1 result sometimes.
+ // try {
+ // const res = await filterLinks({
+ // links: sitemapLinks,
+ // limit: isFinite(limit) ? limit : undefined,
+ // max_depth: maxDepth,
+ // base_url: this.baseUrl,
+ // initial_url: this.initialUrl,
+ // regex_on_full_url: this.regexOnFullURL,
+ // excludes: this.excludes,
+ // includes: this.includes,
+ // allow_backward_crawling: this.allowBackwardCrawling,
+ // ignore_robots_txt: this.ignoreRobotsTxt,
+ // robots_txt: this.robotsTxt,
+ // });
+
+ // const fancyDenialReasons = new Map<string, string>();
+ // res.denial_reasons.forEach((value, key) => {
+ // fancyDenialReasons.set(key, DenialReason[value]);
+ // });
+
+ // return {
+ // links: res.links,
+ // denialReasons: fancyDenialReasons,
+ // };
+ // } catch (error) {
+ // this.logger.error("Error filtering links in Rust, falling back to JS", {
+ // error,
+ // method: "filterLinks",
+ // });
+ // }
const filteredLinks = sitemapLinks
.filter((link) => {