How do I block ads on YouTube?

What is it supposed to do? I mean how does it solve the problem with the app repeatedly looking for ad servers and not playing the video?

This regex is working well so far, no ads. Seems to block the ads before (preroll) but continue to load the actual video. Also no ads during the video. This is all on the YouTube app on a Roku device.

Edit: Never mind, it doesn't seem to be blocking every time. It also blocks all video recommendations after the video finishes. Oh well, was worth a try.

2 Likes

Still that's a very useful improvement. If it removes most of the ads that's great, and I can live without the recommendations as I never look at them anyway.

I'll test it out, see how effective it is here.

To be honest I don't think the regex did anything, as I've had these two lists which have blocked 90% of the ads here so far:

https://raw.githubusercontent.com/HenningVanRaumle/pihole-ytadblock/master/ytadblock.txt https://raw.githubusercontent.com/anudeepND/youtubeadsblacklist/master/domainlist.txt

In my cases (tested on some pi-holes on different locations) the reddit Posting (top level Post) dont work and I think it wont work anymore...
I checked some tcpdumps / dig / nslookup results and I never got such results like this user from reddit (Think youtube changed it).

@anon34989931: Really sure about 90% ? I dont think you can achive 90% with 1~2 yrs outdated lists ?

EDIT: I also checked again nslookup to manifest.googlevideo.com (only on my IPv4 Address not IPv6) and on my connection I get every ~5 mins (or less) another IP back from nslookup...
I think youtube/google uses a very (high expensive) geo-location/CDN System and without auto scripts / tools we're lost and lets say google will change something in their domains: all the work on it / auto scripts have to be changed...

I was surprised given the age of them, but I haven't gotten any ads during a video. Only sometimes before the video starts, once a day or so.

It could be a combination of factors alongside the two lists... I've also got all of WaLLy3K's lists on my Pi-hole, as well as mmotti's custom Regex filters for Pi-hole. I also have blocked Google DNS on my router so 8.8.8.8 and 8.8.4.4 can't go through.

For whoever wants to add the permutations from these to their lists, here are a few more that don't appear to be on any list received today.:

r1---sn-q4fl6ney.googlevideo.com
r5---sn-q4flrnee.googlevideo.com
r5---sn-q4flrn7r.googlevideo.com
r3---sn-q4fl6nlz.googlevideo.com
r5---sn-q4flrner.googlevideo.com
r5---sn-q4flrn7r.googlevideo.com

I tried blocking the ads using the regexp:

^r[0-9]+---sn-+[a-z0-9]+\.googlevideo\.com$

Regexp seems to properly block the domains, but now video's are no longer loading properly.

So no luck thusfar.

So that's a reason for giving up?

2 Likes

I'm pretty sure DNS based Chromecast ad blocking is poissible, I used to use Ad-Free Time which is basically a paid DNS ad blocker service. There Chromecast ad-blocking worked perfectly.

I'm a fan of open source software so I'd rather use pihole. If you have the opinion that trying to block chromecast ads in pihole will never work then just use the solution I posted and stop posting pointless posts in this topic.

First post, kinda bummed as I set all of this up just for blocking YouTube ads network-wide, but hey, I still really enjoy the software. Hopefully we can figure this out soon, so I don't have to use adblock extensions on everything.

I don't think it's possible to fully block YouTube ads any more, without modifying the client (i.e. the app or the browser).

DNS blocking doesn't work. Can't modify requests with a proxy because of HTTPS and the inability to install user certs on things like smart TVs. Can't pretend to be the YouTube server either, also because of HTTPS and I think Google is using pinned certs in the app anyway.

The only solution for smart TVs is to get an Android TV box and run the hacked YouTube client on it.

My friend, you need to stop being so negative, go outside and breathe some fresh air.

You're blogging to hard, a snarky forum comment is not considered "fact", and I'm already using uBlock origin to begin with. Pardon me for attempting to find an alternate solution for a network-wide approach, I guess that's now somehow against your personal terms of service. (lol)

2 Likes

3 posts were split to a new topic: Filtering all data

You can try out some add blocking tools to even encrypt morse codes (techyhost.com/free-morse-code-translator/) one of the best one is Adblock plus. These tools may not always work but they manage to block ads to some extent

Hello.
In recent days, I remark that ads were no longer blocked on YouTube via Pi-Hole. In "Query Log", I state that the addresses of the YouTube ads have been changed. In total, I counted 39 addresses. I made my file available on my GitHub (just copy and paste): https://raw.githubusercontent.com/FleuryK/pihole-ytadblock/master/ytadblock.txt

1 Like

I also noticed a major increase in ads recently. Thank for you for providing this!

Same here. I set this up specifically because the YouTube app on our smart TVs is just brutal. You can’t watch 5 minutes of content without the video being ruined by ads google is injecting.

The KODI YouTube app somehow blocks all the ads but it’s UI is really clunky. I was hoping to setup a PiHole so the kids could watch YT in their rooms without be eviscerated by ads every 30 seconds

Hi All.
Try adding this one to the mix approx 1 million googlevideo domains in the list from memory.
Source: A free Thundercloud by zaclys.com 1 GB
https://ncloud.zaclys.com/index.php/s/TJkqZjCt99Xxjab

Use this one for Pi-Hole.
https://ncloud.zaclys.com/index.php/s/TJkqZjCt99Xxjab/download

1 Like