How do I block ads on YouTube?

right

So whats this latest method for blocking YouTube Ads on Amazon Fire TVs?

1 Like

Where are these rules coming from is it from an Android app? You could actually add these as regex entries as is in Pihole -> Blacklist -> Regex filter

Also do they work only on web browsers? Or do they work for Youtube app as well?

Just checking over the rules listed in those screenshots, they are URLs... Pi-hole can only block via DNS name. For example, it knows nothing about the http(s) part, or anything after the first / such as /get_midroll_

Adding them to Pi-hole will have no effect.

1 Like

Hi, so I'm new to PiHole (I set it up yesterday) and I scrolled through the entire forum, tested a lot of things, still some ads and videos stopped loading. Does anybody have any new developments?

EDIT: YouTube legit stopped working on my iPhone I had to go back to automatic DNS

The TL;DR of this entire thread (and answer to the question posed in the topic title) should probably be:

"Not with Pi-hole, sorry!"

Ultimately, youtube video ads are served from the same content domains as the videos themselves, so the only sure fire way to block ads on youtube is to block youtube all together :wink:

Personally (and I mean personally - this is often a controversial option for whatever reason) I pay for Youtube Premium family, primarily for Google Play Music/Youtube music for myself and 5 other family members - as an added bonus.. no ads on Youtube. However I do understand that paying for a service is not an option for some people.

3 Likes

Okay fair enough. I’m using a adblocker on my browser on my laptop. On my phone, I don’t get a lot of unskippable ads (but they still exist). So, this was kinda a waste to read through.

EDIT: I could also jailbreak my phone because there is a tweak to remove ads from YouTube. Paired with PiHole, I could have no ads on my phone at all.

i dont know if anyone of you are into https://github.com/omarroth/invidious project but u can redirect any youtube video to their instance (invidio . us) or your own docker instance and watch any youtube videos that way with no javascript hell and tracking

edit: here a list of browser extensions that can be setup to redirect the youtube videos to a instance https://github.com/iv-org/invidious/wiki/Extensions

Is this still a valid method for blocking YouTube Ads?

Thanks

Helló!
This is my Pi-hole Blocklist regex filter:

^r[0-9]{1,99}-*sn-*[a-z0-9]{1,99}-[a-z0-9]{1,99}\.googlevideo\.com$

This is very good filter.
Filters out all Youtube ads except 8 characters, such as:
rx.sn-xxxxxxxx.googlevideo.com
I realized that these should not be blocked. If they are blocked, the video will not start.
My filter blocks all but these ads.
Have a nice day.

7 Likes

This worked like a charm! Thank you for this :smiley:

Great thank you, ii worked on the new version of Pi-hole Pi-hole v5.1.1 Web Interface v5.1 FTL v5.1

It's interesting that AdBlockPlus is able to block YouTube ads but PiHole is not. When I started using PiHole and disabled ABP, I started seeing ads on YouTube. I know ABP gets lists of sites to block, so it might be possible to pull/import ABP's list into PiHole. Alternately, I'll just disable ABP for all those websites that realize ABP is blocking their ads and leave ABP active for YouTube specifically...

It is possible, but will cause a world of problems. Support for Adblock formatted lists was dropped several versions ago, as these lists are not compatible with Pi-hole and cause many false positives.

Don't do this.

Pihole blocks on domain level. Youtube serves ads from the same domains as the videos. But ABP can also block content on URL level (like youtube.com/ads).

Pihole won't understand them and skip them. But you may create false positives.

A good approach is to use pihole and a browser plugin at the same time :wink:

Awesome info, and thanks for the responses yubiuser and jfb!

Thanks for the filter. I had to change it to make it work for me. Maybe it's due to the country (Germany) or the structure of the URL has changed in the meantime. Here is my version (one - less in the end):

^r[0-9]{1,99}-*sn-*[a-z0-9]{1,99}[a-z0-9]{1,99}\.googlevideo\.com$

if you want to create your own filter this webseite might be useful:

Edit:
2 hours later: With activated filter no YT video is played anymore. Either YT checks whether ads have been played or they then deliver the video via the same URL

1 Like

Thanks for that filter. Works very well! At my setup (Samsung TV, Poland) blocks I think 90% of YT ads.

Any updates on your idea?

This extension for Chrome plus the Pi-Hole with the filter from Snapsz worked perfectly for me.

https://chrome.google.com/webstore/detail/adblock-for-youtube/cmedhionkhpnakcndndgjdbohmhepckk?hl=en