$ext = "*.html","*.htm","*.php","*.js","*.css"
$files = Get-ChildItem -Recurse -File -Include $ext
$domains = foreach($f in $files){
$c = Get-Content $f.FullName -Raw -ErrorAction SilentlyContinue
if(!$c){ continue }
# ambil semua URL yang mengandung domain
[regex]::Matches($c, '(https?:)?//([a-z0-9.-]+\.[a-z]{2,})(:[0-9]+)?(/[^\s"''<>)]+)?', 'IgnoreCase') |
ForEach-Object { $_.Groups[2].Value.ToLower() }
}
$domains |
Sort-Object |
Group-Object |
Sort-Object Count -Descending |
Select-Object Count, Name |
Format-Table -AutoSize