Skip to content

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

Merge branch 'feat/map-few-results' of github.com:mendableai/firecrawl into feat/map-few-results

Ademílson Tonatoc29b7d4a8c46
diff --cc apps/api/src/lib/url-utils.ts
index 23735194e,4d9ccc8db..c5b3b5e1d
--- a/apps/api/src/lib/url-utils.ts
+++ b/apps/api/src/lib/url-utils.ts
@@@ -24,11 -26,17 +26,21 @@@ export function isBaseDomain(url: strin
? hostname.slice(4)
: hostname;
+ if (cleanHostname !== parsed.domain) {
+ return false; // Has subdomains
+ }
+
+ // Check if there's a path beyond the root
+ const pathname = urlObj.pathname;
+ if (pathname && pathname !== "/" && pathname.trim() !== "") {
+ return false; // Has a path
+ }
+
- return true;
+ // Compare against extracted base domain (handles multi-part TLDs)
+ const baseDomain = extractBaseDomain(url);
+ if (!baseDomain) return false;
+
+ return cleanHostname === baseDomain;
} catch (error) {
// If URL parsing fails, consider it not a base domain
return false;