Adblocker/create-adblock.sh

28 lines
671 B
Bash
Raw Normal View History

2023-07-21 21:37:00 +00:00
#!/bin/bash
2023-07-25 19:32:27 +00:00
set -e -u
2023-07-21 21:37:00 +00:00
2023-07-24 21:03:45 +00:00
#Adblock Listen herunterladen
2023-07-21 21:37:00 +00:00
while read p; do
wget -qO - $p >> all-adblock.txt
done <adblocklists.txt
date=$(date '+%a, %d %b %Y %H:%M:%S %z')
2023-07-24 21:03:45 +00:00
#Kommentare in den Listen löschen
2023-07-21 21:37:00 +00:00
sed 's/^!.*$//g' all-adblock.txt > allfilters.txt
2023-07-24 21:03:45 +00:00
#Header erstellen
2023-07-21 21:37:00 +00:00
echo '! Title: Mainboarder kompiliert
! Description: Filters optimized for uBlock, for single list use, deduplicated
! Expires: 2 days
! Last modified: '"$date"'
2023-07-24 20:48:53 +00:00
! Homepage: https://git.mainboarder.de/Public/Adblocker
2023-07-21 21:37:00 +00:00
!' > all-adblock.txt
2023-07-24 21:03:45 +00:00
#Eigene Regeln hinzufügen
cat own-rules.txt >> all-adblock.txt
#Duplikate entfernen
2023-07-21 21:37:00 +00:00
awk '!seen[$0]++' allfilters.txt >> all-adblock.txt
rm allfilters.txt