feat: remove blacklistlinks source

This commit is contained in:
Ming Di Leom 2024-08-31 02:27:27 +00:00
parent e9f7ed696e
commit 6ea8f197fe
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
2 changed files with 1 additions and 15 deletions

View File

@ -12,12 +12,9 @@ const f = async () => {
const outputFile = join(__dirname, '../tmp/domains-raw.txt')
await rm(outputFile, { force: true })
const domainsPath = join(__dirname, '../tmp/blacklistdomains.json')
const linksPath = join(__dirname, '../tmp/blacklistlinks.json')
const domainsStr = await readFile(domainsPath)
const domainsArray = parse(domainsStr)
const linksStr = await readFile(linksPath)
const linksArray = parse(linksStr)
const domains = new Set()
@ -31,16 +28,6 @@ const f = async () => {
const domain = parsedUrl.hostname.replace(/\\/g, '').replace(/^www\./, '')
domains.add(domain)
}
for (const { url } of linksArray) {
let parsedUrl = new URL('http://example.com')
try {
parsedUrl = new URL(url)
} catch {
continue
}
const domain = parsedUrl.hostname.replace(/\\/g, '').replace(/^www\./, '')
domains.add(domain)
}
await writeFile(outputFile, Array.from(domains).join('\n'))
}

View File

@ -49,7 +49,6 @@ cd "tmp/"
# Prepare datasets
curl -L "https://api.chongluadao.vn/v2/blacklistdomains" -o "blacklistdomains.json"
curl -L "https://api.chongluadao.vn/v2/blacklistlinks" -o "blacklistlinks.json"
# Extract tracking links
node "../src/script.js"
@ -67,7 +66,7 @@ SECOND_LINE="! Updated: $CURRENT_TIME"
THIRD_LINE="! Expires: 1 day (update frequency)"
FOURTH_LINE="! Homepage: https://gitlab.com/malware-filter/vn-badsite-filter"
FIFTH_LINE="! License: https://gitlab.com/malware-filter/vn-badsite-filter#license"
SIXTH_LINE="! Source: https://api.chongluadao.vn/v2/blacklistdomains & https://api.chongluadao.vn/v2/blacklistlinks"
SIXTH_LINE="! Source: https://api.chongluadao.vn/v2/blacklistdomains"
COMMENT_UBO="$FIRST_LINE\n$SECOND_LINE\n$THIRD_LINE\n$FOURTH_LINE\n$FIFTH_LINE\n$SIXTH_LINE"
mkdir -p "../public/"