Skip to content

Instantly share code, notes, and snippets.

@g3rhard
Last active January 13, 2024 17:09
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save g3rhard/71fe0b95e69736f442dff5e8615245bf to your computer and use it in GitHub Desktop.
Save g3rhard/71fe0b95e69736f442dff5e8615245bf to your computer and use it in GitHub Desktop.
Adding EasyList subscriptions for PiHole project
#!/usr/bin/perl -w
#Source: https://newspaint.wordpress.com/2014/08/18/filtering-easylist-for-hosts-file-style-adblock/
use strict;
my %hosts = ();
while ( <> ) {
if ( $_ =~ m/^\|\|([a-z][a-z0-9-_.]+\.([a-z]{2,3}))\^\s*$/ ) {
$hosts{$1} = 1;
}
}
foreach my $host ( sort keys %hosts ) {
print( "$host\n" );
}
https://easylist-downloads.adblockplus.org/easylist.txt
https://easylist-downloads.adblockplus.org/abpindo+easylist.txt
https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/abpindo.txt
https://easylist-downloads.adblockplus.org/bulgarian_list+easylist.txt
http://stanev.org/abp/adblock_bg.txt
https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt
https://easylist-downloads.adblockplus.org/easylistchina.txt
https://easylist-downloads.adblockplus.org/easylistczechslovak+easylist.txt
https://raw.github.com/tomasko126/easylistczechandslovak/master/filters.txt
https://easylist-downloads.adblockplus.org/easylistdutch+easylist.txt
https://easylist-downloads.adblockplus.org/easylistdutch.txt
https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt
https://easylist-downloads.adblockplus.org/easylistgermany.txt
https://easylist-downloads.adblockplus.org/israellist+easylist.txt
https://raw.githubusercontent.com/ABPIsrael/EasyListHebrew/master/EasyListHebrew.txt
https://easylist-downloads.adblockplus.org/easylistitaly+easylist.txt
https://easylist-downloads.adblockplus.org/easylistitaly.txt
https://easylist-downloads.adblockplus.org/easylistlithuania+easylist.txt
http://margevicius.lt/easylistlithuania.txt
https://easylist-downloads.adblockplus.org/latvianlist+easylist.txt
https://notabug.org/latvian-list/adblock-latvian/raw/master/lists/latvian-list.txt
https://easylist-downloads.adblockplus.org/liste_ar+liste_fr+easylist.txt
https://easylist-downloads.adblockplus.org/Liste_AR.txt
https://easylist-downloads.adblockplus.org/liste_fr+easylist.txt
https://easylist-downloads.adblockplus.org/liste_fr.txt
https://easylist-downloads.adblockplus.org/rolist+easylist.txt
http://www.zoso.ro/pages/rolist.txt
https://easylist-downloads.adblockplus.org/ruadlist+easylist.txt
https://easylist-downloads.adblockplus.org/advblock.txt
https://easylist-downloads.adblockplus.org/easylistspanish.txt
https://easylist-downloads.adblockplus.org/easyprivacy+easylist.txt
https://easylist-downloads.adblockplus.org/easyprivacy.txt
http://adblock.gardar.net/is.abp.txt
http://www.void.gr/kargig/void-gr-filters.txt
http://bit.ly/11QrCfx
http://adblock.dajbych.net/adblock.txt
http://gurud.ee/ab.txt
http://abp.mozilla-hispano.org/nauscopio/filtros.txt
https://raw.githubusercontent.com/szpeter80/hufilter/master/hufilter.txt
http://pgl.yoyo.org/adservers/serverlist.php?hostformat
https://adblock.dk/block.csv
http://noads.it/filtri.txt
https://raw.githubusercontent.com/yous/YousList/master/youslist.txt
https://easylist-downloads.adblockplus.org/antiadblockfilters.txt
https://easylist-downloads.adblockplus.org/adwarefilters.txt
https://easylist-downloads.adblockplus.org/fanboy-annoyance.txt
https://easylist-downloads.adblockplus.org/fanboy-social.txt
http://www.kiboke-studio.hr/i-dont-care-about-cookies/abp/
https://easylist-downloads.adblockplus.org/malwaredomains_full.txt
https://raw.github.com/liamja/Prebake/master/obtrusive.txt
https://raw.githubusercontent.com/Dawsey21/Lists/master/adblock-list.txt
#!/bin/bash
for source in $(cat lists.lst); do
echo $source;
curl --silent $source >> ads.txt
echo -e "\t`wc -l ads.txt | cut -d " " -f 1` lines downloaded"
done
echo -e "\nFiltering non-url content..."
perl easylist.pl ads.txt > ads_parsed.txt
rm ads.txt
echo -e "\t`wc -l ads_parsed.txt | cut -d " " -f 1` lines after parsing"
echo -e "\nRemoving duplicates..."
sort -u ads_parsed.txt > ads_unique.txt
rm ads_parsed.txt
echo -e "\t`wc -l ads_unique.txt | cut -d " " -f 1` lines after deduping"
cat ads_unique.txt >> /etc/pihole/adblock.raw
sort -u /etc/pihole/adblock.raw > /var/www/html/pihole/adblock.hosts
rm /etc/pihole/adblock.raw
rm ads_unique.txt
pihole -g
@JacobMalloy
Copy link

for source in cat lists.lst; do
in manual-easylist.sh should be changed to
for source in cat list.lst; do

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