Skip to content

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

added regex for links in sitemap

rafaelsideguidea684bd3c5d76
diff --git a/apps/api/src/scraper/WebScraper/crawler.ts b/apps/api/src/scraper/WebScraper/crawler.ts
index 59b536422..00d518531 100644
--- a/apps/api/src/scraper/WebScraper/crawler.ts
+++ b/apps/api/src/scraper/WebScraper/crawler.ts
@@ -64,6 +64,14 @@ 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 path = url.pathname;