Ads are served through the same domains as normal video clips. Until I find a better solution, please be mindful of this issue and consider this as experimental.
- scans log files, including archived logs
- can process multiple files in parallel
- compiles a unique list with the extracted domains
- offers the option to add (blacklist) the extracted domains directly to
pihole
- low memory footprint and extremely fast
- no dependencies
- you don't need to install anything (check
bin
folder)
$ git clone https://github.com/foae/pihole-youtube-block.git
$ cd pihole-youtube-block
$ go run main.go
$ cd bin
$ ./ytblock-rpi
$ cd bin
$ ./ytblock
All gathered domains will be written to compiled_domains.txt
You can easily tweak the configuration; it has sensible defaults.
File config.json
"PIHOLE_LOGS_DIR": "/var/log/",
– path to your pihole logs"COMPILED_FILE_NAME": "./compiled_domains.txt",
– name of the file used to collect all domains from logs"LOG_FILE_NAME_PREFIX": "pihole.log"
– if your pihole log files bear a different name, change this with the common prefix of your log files that you want scanned"POP_CONFIRMATION_DIALOGUE": true
– change tofalse
to skip the confirmation dialogue and send the found domains directly to pihole without asking. Useful for scripting.
blana@raspberrypi:~/pihole-youtube-block/bin $ ./ytblock-rpi
>>> Waiting for all jobs to finish...
2018/11/30 19:19:14 Finished processing file (/var/log/pihole.log) in (1.964928163s).
2018/11/30 19:19:16 Finished processing file (/var/log/pihole.log.1) in (3.518280066s).
2018/11/30 19:19:18 Finished processing file (/var/log/pihole.log.2.gz) in (5.431282712s).
>>> Done: (125) unique extracted domains written to (./compiled_domains.txt) in (5.48431123s)
-----------
Would you like to stick those (125) collected domains into *your* pihole? (y/n)
-----------
n
2018/11/30 19:19:20 No is a no. Bye.
MIT License