Browse Source

improve blocklist generation script

master
Peter Cai 1 year ago
parent
commit
006603de0f
  1. 4
      generate_blocklist.sh

4
generate_blocklist.sh

@ -2,7 +2,9 @@
function import_hosts() {
local url=$1
curl "$url" | sed '/^#/d' | sed 's/0.0.0.0 //g' | sed 's/127.0.0.1 //g' | grep '\S'
# Trim lines, remove comments, convert tabs to spaces, collapse multiple spaces, and
# take the second column of the output
curl "$url"| sed -E 's/^[ \t]+//g' | sed '/^#/d' | sed 's/\t/ /g' | sed -E 's/[ ]+/ /g' | cut -d ' ' -f 2 | grep '\S'
}
# In blocklist_config, put a list of URLs to shared ad-blocking hosts files

Loading…
Cancel
Save