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
fix(crawler): verify URL
Gergő Móricz8e3c2b28550a
diff --git a/apps/api/src/scraper/WebScraper/crawler.ts b/apps/api/src/scraper/WebScraper/crawler.tsindex 67f1c22ec..92b9ae408 100644--- a/apps/api/src/scraper/WebScraper/crawler.ts+++ b/apps/api/src/scraper/WebScraper/crawler.ts@@ -108,7 +108,12 @@ export class WebCrawler {// Normalize the initial URL and the link to account for www and non-www versionsconst normalizedInitialUrl = new URL(this.initialUrl);- const normalizedLink = new URL(link);+ let normalizedLink;+ try {+ normalizedLink = new URL(link);+ } catch (_) {+ return false;+ }const initialHostname = normalizedInitialUrl.hostname.replace(/^www\./, '');const linkHostname = normalizedLink.hostname.replace(/^www\./, '');