Couple thoughts on how to block Youtube ads

When watching a youtube video, have noticed the following lookups in pi-hole

Domain | Status | Reply
r1---sn-b3nsrq7d.googlevideo.com | OK (forwarded) | CNAME (11.5ms)
r1---sn-b3nsrq7d.googlevideo.com | OK (forwarded) | N/A (0.0ms)

This had me thinking that if we assume the first lookup (on the bottom) is the for video itself, and the second one (on top) is for the ad, could we block the second one, but not the first?

If this assumption is true, it leads to a couple of possibilites.

  1. Could we have an extra blacklist that is only used for CNAME replies?
  2. Could we allow any particular subdomain of *.googlevideo.com through, but only once per second/minute/hour/day/ever? The first lookup would go through, but the second would be blocked, since it was too close to the previous.
  3. Can we have some script or routine run on every request? The script can maintain its own logic for blocking, i.e. block every 2nd request from a particular domain, or block a domain if we are within certain hours?

No idea if any of these are possible.
Option 1. would be an additional blacklist that would be parsed just for CNAME.
Option 2. would be similar to some sort of rate limiting to a particular subdomain.
Option 3. would be the most customizable, but I have no idea how to go about it.

Does the initial assumption hold? Are any of these ideas reasonable or practical? If any are, any thoughts on how to go about it? Might be a feature request, but also might already be possible, and just need to be pointed in the right direction.

Dear @rasdasd,

blocking youtube ads is not possible with pihole due to technical reasons (ads are served from the same domain as the videos). Search the forum and you will find numerous failed attempts to block the ads. Save your time and use a browser plugin that is capable to blocking on URL level.

1 Like