According to the above reply this might not work.
However trough my (short!) tests I haven’t seen any ads whilst using pi-hole to block the googlevideo.com subdomains.
Anyhow, to automate a lot of the manual steps I made a script.
So you will need the unoffical dns dumpster API from here: https://github.com/PaulSec/API-dnsdumpster.com
I cloned this git to a folder /etc/dnsdumpster/ with the commands:
git clone https://github.com/PaulSec/API-dnsdumpster.com /etc/dnsdumpster
If everything went according to plan you should now have 4 files in the above folder amongs which should be:
Make sure you have python and pip installed and use the following commands:
pip install -r requirements.txt
Now edit the API-example.py using vi
you have to edit the line
res = DNSDumpsterAPI(False).search('tesbro.com')
to the following
res = DNSDumpsterAPI(False).search('googlevideo.com')
Now this should make the example api output everything that dnsdumpster shows/does
Next is to make a script in /etc/pihole, I named it youtube-ads.sh
It should contain the following code:
python /etc/dnsdumpster/API_example.py > /etc/dnsdumpster/youtube-domains.txt
grep "^r" /etc/dnsdumpster/youtube-domains.txt > /etc/dnsdumpster/youtube-filtered.txt
sed 's/\s.*$//' /etc/dnsdumpster/youtube-filtered.txt > /etc/dnsdumpster/youtube-ads.txt
cp /etc/dnsdumpster/youtube-ads.txt /var/www/html/youtube.txt
Make the script executable:
chmod +x /etc/pihole/youtube-ads.sh
Now you should do the following to add your youtube.txt to the block lists in pihole:
cp /etc/pihole/adlists.default /etc/pihole/adlists.list
In this file add the following to the bottom:
# My local list
Save the file and edit your crontabs to automate the process
Add the following line:
0 0 * * * /etc/pihole/youtube-ads.sh
This should run the script daily and might remove youtube ads.
– I am by no means a linux/pi-hole expert, the above is what I did to make it work.
Sure things could be better and if anyone has anything to add, please do tell me!
All I know is that for me it seems to work using the above.