diff --git a/generate_blocklist.sh b/generate_blocklist.sh index 2bbab6c..0baa346 100755 --- a/generate_blocklist.sh +++ b/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