How do I block ads on YouTube?

Hey GobIE Thank you. I was able to install couple hours ago but most videos on chrome and on my phone don’t even start. Thx

For the neophytes in the matter, could an installation command be done that already includes the ".deb" file so as not to do it separately?

Yes, the unlocker mechanism has some difficulties to detect deadlock some time. In fact with several videos, youtube address change when you reload it, so it can't detect that it's the same video.
Now I can reproduce this problem on my side, I work on this point by changing the strategy to improve user experience.
For the moment you must reload your video to allow it to detect the situation (two accesses to the same server in 1m30) until your video can be loaded.

With one *.sh file which contains deb+installation commands for example ?

Thanks @GoblE, if the command "sudo dpkg -i <deb_file>, etc" install or copy the .deb file in the right place without any further intervention than copying the command line in the terminal of Putty.

Thanks for clarifying... hopefully you will find a away to work it.

It is Game Over !
Google already use DNS over HTTPS, and it is not possible to block ads any more from official Youtube apps from smart TV, android ... all that use official google API.

Where is the source coming from?
maybe pihole or firewall use filter all dns.google or dns.google.com

From my tests the BIG problem is that G. API will not switch back to DNS servers defined by DHCP server if I block on firewall all G. DNS servers over HTTPS.
You block Google DNS servers over HTTPS you can't watch youtube, can't use G maps, or G translate... so good luck blocking google ads.
Why do you think Google/Alphabet support and developed DNS over HTTPS ?
For privacy ? Let's be serious, it is only for profit.

1 Like

Your remark is interesting, since Wednesday pi-hole can't catch DNS request from my iPad (Youtube application) but works with my iPhone and I tried to understand why.

What it means exactly : on a device X, Youtube application uses DHCP server by default but switches definitely on DNS over HTTPS for this device X if it has trouble to get response with the DHCP?

IMO the best way to block ads in YouTube is by avoiding it completely :wink:

I suggest using https://invidio.us/ instead. Invidious is an open-source front-end for YouTube. It works without javascript enabled (unless you want to see the comments for each video) and you won't see any ads.

By default, you'll see network requests to googlevideo.com. However, even this can be avoided by checking the "Proxy videos?" option in the settings in the upper right corner.

Note that there are several Invidious instances available which might be more performant than invidio.us.

The best way to use it, IMO, is by installing the Invidition add-on for Firefox which redirects all requests to YouTube (even in embedded videos on other sites) to invidio.us (or, alternatively, to one of the other instances). You can check the option "Force proxy" to avoid googlevideo.com.

Result: a Google-free YouTube :smile:

Note: If you're using uMatrix or Noscript you might want to add the appropriate rulesets for those add-ons available on the Invidition homepage.

1 Like

[quote="pi-user, post:364, topic:253, full:true"]I suggest using https://invidio.us/ instead.
[/quote]

Doesn't work with smart TVs.

Yes, that's a problem for sure. Perhaps there is a solution similar to what is discussed here.

Thank you so much for the answers worked for me

In this thread I see some scripts generating blacklists.
but if you do that, You might just as well add the following regex

((^)|(\.))googlevideo\.

It probably is faster as your name server doesn't have to crawl through all the results.
for normal videos, YouTube will fall back to another domain.
but if there is a commercial, you cannot see it but have to refresh to show the page.
that isn't really a solution.

for some reason my add blocker is able to determine and exclude YouTube commercials. Of course my add-blocker has more information then only the host name, I has access to actual content.

Assuming mobile apps use the same host names as the webapplication.
We can create an online list with host names to block.
and a webservice where urls can be submitted.
then create an add on for Firefox and Chrome which detects the urls with youtube commercials and if one is detected it should be submitted to the webapi.

It is a lot of work, no doubt about that, also to prevent people from adding other domains manually.
But I think it is doable.
The more people who use this add on the more accurate the block will be.

anyone any thoughts on this, also it would be helpfull if someone would know if the host urls for YouTube apps would be the same as for the webversion.

Edit:
Ok, forget what I said before, it's just not going to work, I checked what my add blocker does. Different from blocking complete domains, it blocks this script

https://www.youtube.com/get_midroll_info?ei=8QQAXa.........

which cannot be blocked simply by host,
I checked to scripts, and found a suspicious domain "v3m.uuzu.com" not sure wat is does, but I added it to the blacklist just to be sure,it doesn't help at all.

Hi
I have a similar problem to yours, I have installed your ads-catcher, it seems like working (fewer ads) from all of my devices except my iPad (don't know why).

I can only see that in the log file:
[2019. jún. 25., kedd, 19:29:23 CEST] ads-catcher-blacklister
[i] Adding r3---sn-po8puxa-c0qs.googlevideo.com to blacklist...
[i] r3---sn-po8puxa-c0qs.googlevideo.com does not exist in whitelist, no need to remove!
[i] r4---sn-po8puxa-c0qs.googlevideo.com already exists in blacklist, no need to add!
[i] r4---sn-po8puxa-c0qs.googlevideo.com does not exist in whitelist, no need to remove!

[i] Pi-hole blocking is enabled
[i] Using cached Event Horizon list...
[i] 114874 unique domains trapped in the Event Horizon
[i] Number of blacklisted domains: 123
[i] Number of regex filters: 1
[✓] Parsing domains into hosts format
[✓] Cleaning up stray matter

[✓] DNS service is running
[✓] Pi-hole blocking is Enabled

Maybe you can explain, or have solution to that.
Thanks in advance!

Bence

hi guys
On the topic "ads in Youtube" ...
For my part I work with the following regex in the blacklist.
grafik
I am satisfied with the result. This regex does not filter every advertisement, but still a lot.
Just give it a try ... :slight_smile:

EDIT: 12.07.2019
Regex inserted as image because the regex was misrepresented by HTML display.

Last time I tried blocking ads for YouTube, videos weren't loading :frowning: I had to refresh the page multiple times to get a video.

I've added the regex above you and I can still play videos on pc and mobile. Ads still coming in though.

Would you say you have less ads? I would like to remove uBlock as some websites are angry at me now :stuck_out_tongue: But I hate 2 full ads before a video too so...

i'm new to this world, would you please tell me how to install this script on pi-hole ? thanks