How do I block ads on YouTube?

I read today that appending a dot to YouTube.com
removes a lot of ads too.

e. g. https://youtube.com./{RESTOFURL}

how would I implement a url rewrite in that case?

or am I mistaken and it's already implemented?

thanks

Blocking ads by adding dot at the end of domain name

Not sure how this could fit, help or else, nor whether it be warranted. But I have few rules that is used to successfully blocked youtube ads with a 100% clean view. The problem, I have combined these regex from another interface... but throwing it in here, maybe could be adapted for pi-hole somehow, or based idea for pi-hole to successfully get rid of these ads...

The 'Hide Elements' are not applicable to Pi-hole.

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!