Skip to content

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

Update apps/api/src/scraper/WebScraper/crawler.ts

Rafael Miller5e728c1a4d12
diff --git a/apps/api/src/scraper/WebScraper/crawler.ts b/apps/api/src/scraper/WebScraper/crawler.ts
index 00d518531..640eada00 100644
--- a/apps/api/src/scraper/WebScraper/crawler.ts
+++ b/apps/api/src/scraper/WebScraper/crawler.ts
@@ -64,15 +64,7 @@ export class WebCrawler {
private filterLinks(sitemapLinks: string[], limit: number, maxDepth: number): string[] {
return sitemapLinks
.filter((link) => {
-
- // if link is not a complete url, add the base url
- link = link.trim();
- const isCompleteUrl = new RegExp('^(?:[a-z+]+:)?//', 'i');
- if (!isCompleteUrl.test(link)){
- link = this.baseUrl + link;
- }
-
- const url = new URL(link);
+ const url = new URL(link.trim(), this.baseUrl);
const path = url.pathname;
const depth = getURLDepth(url.toString());