https://github.com/foae/pihole-youtube-block
Scan pihole logs and block YouTube ads domains
https://github.com/foae/pihole-youtube-block
pihole pihole-ads-list pihole-blocklists pihole-youtube-ads youtube-ads youtube-blocker
Last synced: 9 months ago
JSON representation
Scan pihole logs and block YouTube ads domains
- Host: GitHub
- URL: https://github.com/foae/pihole-youtube-block
- Owner: foae
- License: mit
- Archived: true
- Created: 2018-11-27T10:56:49.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-29T10:31:32.000Z (over 6 years ago)
- Last Synced: 2024-09-22T19:32:32.504Z (over 1 year ago)
- Topics: pihole, pihole-ads-list, pihole-blocklists, pihole-youtube-ads, youtube-ads, youtube-blocker
- Language: Go
- Size: 30.8 MB
- Stars: 65
- Watchers: 7
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### Warning: it might block YouTube completely.
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.
# pihole-youtube-block
#### Scans logs generated by `pihole` and extracts domains used to serve ads on YouTube
* 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)
##### Getting started
```bash
$ git clone https://github.com/foae/pihole-youtube-block.git
$ cd pihole-youtube-block
```
##### How to run if you have `go` installed
```bash
$ go run main.go
```
##### How to run it without having `go` installed
###### For ARM (Raspberry Pi and alternatives)
```bash
$ cd bin
$ ./ytblock-rpi
```
###### For all others
```bash
$ 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 to `false` to skip the confirmation dialogue and send the found domains directly to pihole without asking. Useful for scripting.
##### Example output
```bash
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.
```
##### License
MIT License