Full-stack Next.js 16 app with three scraping pipelines: - AirScale CSV → Anymailfinder Bulk Decision Maker search - LinkedIn Sales Navigator → Vayne → Anymailfinder email enrichment - Apify Google SERP → domain extraction → Anymailfinder bulk enrichment Includes Docker multi-stage build + docker-compose for Coolify deployment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
export function cleanDomain(raw: string): string {
|
|
if (!raw) return "";
|
|
let domain = raw.trim().toLowerCase();
|
|
// Remove protocol
|
|
domain = domain.replace(/^https?:\/\//i, "");
|
|
// Remove www.
|
|
domain = domain.replace(/^www\./i, "");
|
|
// Remove paths, query strings, fragments
|
|
domain = domain.split("/")[0];
|
|
domain = domain.split("?")[0];
|
|
domain = domain.split("#")[0];
|
|
// Remove trailing dots
|
|
domain = domain.replace(/\.$/, "");
|
|
return domain;
|
|
}
|
|
|
|
export function extractDomainFromUrl(url: string): string {
|
|
try {
|
|
const parsed = new URL(url.startsWith("http") ? url : `https://${url}`);
|
|
return parsed.hostname.replace(/^www\./i, "").toLowerCase();
|
|
} catch {
|
|
return cleanDomain(url);
|
|
}
|
|
}
|
|
|
|
const SOCIAL_DIRS = [
|
|
"linkedin.com", "facebook.com", "instagram.com", "twitter.com",
|
|
"x.com", "yelp.com", "google.com", "maps.google.com", "wikipedia.org",
|
|
"xing.com", "youtube.com", "tiktok.com", "pinterest.com",
|
|
];
|
|
|
|
export function isSocialOrDirectory(domain: string): boolean {
|
|
return SOCIAL_DIRS.some(d => domain === d || domain.endsWith(`.${d}`));
|
|
}
|