Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(
echo 'return{'
for a in $(jq '.[].trigger["url-filter"]' disconnect-advertising.json |
cut -f3 -d? | sed 's:\\\\.:.:g' | sed s:\"::)
do
echo \"$a\",
done
echo '}'
) > blocklist.lua
@jangrewe

This comment has been minimized.

Copy link

@jangrewe jangrewe commented May 15, 2019

A simpler(?) command: jq -r '.[].trigger["url-filter"]' disconnect-advertising.json | sed 's:.*?::; s:\\::g; s:/.*::'
Notice the -r argument for jq, that strips a lot of characters already.
Full script: https://git.faked.org/jan/powerdns-adblock/blob/master/generate_blocklist.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment