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
Update blocklist.ts
Nicolase98434606d77
diff --git a/apps/api/src/scraper/WebScraper/utils/blocklist.ts b/apps/api/src/scraper/WebScraper/utils/blocklist.tsindex c6a1232eb..2a047e46e 100644--- a/apps/api/src/scraper/WebScraper/utils/blocklist.ts+++ b/apps/api/src/scraper/WebScraper/utils/blocklist.ts@@ -1,5 +1,6 @@const socialMediaBlocklist = ['facebook.com',+ 'x.com','twitter.com','instagram.com','linkedin.com',@@ -32,9 +33,17 @@ const allowedKeywords = [];export function isUrlBlocked(url: string): boolean {+ // Check if the URL contains any allowed keywordsif (allowedKeywords.some(keyword => url.includes(keyword))) {return false;}- return socialMediaBlocklist.some(domain => url.includes(domain));+ // Check if the URL matches any domain in the blocklist+ return socialMediaBlocklist.some(domain => {+ // Create a regular expression to match the exact domain+ const domainPattern = new RegExp(`(^|\\.)${domain.replace('.', '\\.')}$`);+ // Test the hostname of the URL against the pattern+ return domainPattern.test(new URL(url).hostname);+ });}+