Add chnsite.ps1

This commit is contained in:
Netch
2021-08-14 05:20:20 +08:00
parent 5c99396553
commit ce5f39fab1

27
scripts/deps/chnsite.ps1 Normal file
View File

@@ -0,0 +1,27 @@
param (
[string]
$OutputPath
)
try {
Invoke-WebRequest `
-Uri 'https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf' `
-OutFile 'chnsite.txt'
}
catch {
exit 1
}
foreach ( $data in (Get-Content -Path 'chnsite.txt') ) {
$data = $data.Replace('server=/', '')
$data = $data.Replace('/114.114.114.114', '')
$data = $data.Trim()
if ( $data.Length -gt 0 ) {
Add-Content -Path 'newsite.txt' -Value $data
}
}
mv -Force 'newsite.txt' 'chnsite.txt'
mv -Force 'chnsite.txt' $OutputPath
exit 0