Skip to content

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

Update blocklist.ts

Nicolase98434606d77
diff --git a/apps/api/src/scraper/WebScraper/utils/blocklist.ts b/apps/api/src/scraper/WebScraper/utils/blocklist.ts
index 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 keywords
if (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);
+ });
}
+