Skip to content

Instantly share code, notes, and snippets.

@ewpratten
Last active October 25, 2024 16:37
Show Gist options
  • Save ewpratten/a25ae63a7200c02c850fede2f32453cf to your computer and use it in GitHub Desktop.
Save ewpratten/a25ae63a7200c02c850fede2f32453cf to your computer and use it in GitHub Desktop.
youtube ads hosts file
This project has been moved to a GitHub repository to allow Pull Requests.
See: https://github.com/Ewpratten/youtube_ad_blocklist
@BuzzardEagle
Copy link

Hello I have copy pasted this addresses in the host file , BUT Youtube ads keep coming without even any problems , what should i do ??

@ewpratten
Copy link
Author

The youtube ads domains change all the time, and are different depending on the region. I try to keep this list up to date, but things will always slip by

@peter9811
Copy link

Thanks
This work on Windows? I want try it

@ewpratten
Copy link
Author

Hey @peter9811

This list is specifically designed for PIHole and Linux servers, but should work fine locally on windows. I do not use Windows, so I will be unable to help you if you have an issue getting it running though.

@GitHubb3R
Copy link

Thanks
This work on Windows? I want try it

Yes it does, but the hosts may or may not be up to date, because updating these is kind of an uphill battle, since there are people on the advertising end who are paid to screw with you, all the while you do this for free.

You can modify the hosts file in Windows like this:
https://support.microsoft.com/en-us/help/972034/how-to-reset-the-hosts-file-back-to-the-default
Now this points you to reset the file, but its the path of the file that matters. (I've linked this, since this is an official documentation.)

Make sure you copy and paste the these into the hosts file (whereas # is for comments, lines beginning with it are ignored). You will also need Administrator permissions to do these modifications. And an important thing to keep in mind is, that you cannot block certain Microsoft related hosts using this way, but I think there are none listed here (thankfully).

@fte
Copy link

fte commented Jul 2, 2020

commented s.ytimg.com to make music.youtube worky

@Lyceris-chan
Copy link

commented s.ytimg.com to make music.youtube worky

I love you

@aisivan36
Copy link

Some ads still appear, how to block all of them?

@ewpratten
Copy link
Author

pay for premium?

Nobody has the time to track down every single domain name they use. Its not realistic.

@Lyceris-chan
Copy link

Some ads still appear, how to block all of them?

install youtube music as a web app and use vanced on mobile this way you can just use an adblock extension without issues

@ewpratten
Copy link
Author

Some ads still appear, how to block all of them?

If you are on android, you can also check out: https://github.com/TeamNewPipe/NewPipe

@gitdine
Copy link

gitdine commented Dec 6, 2020

Blocking youtube-nocookie.com and www.youtube-nocookie.com breaks many embedded YouTube videos.

@ewpratten
Copy link
Author

@gitdine Unblocked.

@Igor-GS
Copy link

Igor-GS commented Dec 23, 2020

It works! :D Thank you very much!

@Igor-GS
Copy link

Igor-GS commented Dec 28, 2020

I started use the hosts file and there is not appear Google Maps layer in applications that use it ¯_(ツ)_/¯

@gatinhonico
Copy link

Please ADD these to your host file to block ADS on youtube all thanks

r2---sn-5hne6n7z.googlevideo.com
r2---sn-25ge7nsd.googlevideo.com
r4---sn-25ge7nsk.googlevideo.com
r6---sn-25ge7nsl.googlevideo.com
r1---sn-25glen7y.googlevideo.com
r1---sn-25glenez.googlevideo.com
r10---sn-4gxx-25gel.googlevideo.com
r11---sn-4gxx-25ge7.googlevideo.com
r4---sn-4gxx-25gee.googlevideo.com
r16---sn-4gxx-25ge7.googlevideo.com
r3---sn-4gxx-25gel.googlevideo.com
r1---sn-4gxx-25gel.googlevideo.com
r9---sn-4gxx-25gel.googlevideo.com
r9---sn-4gxx-25gy.googlevideo.com
r6---sn-4g5e6nes.googlevideo.com

@ewpratten
Copy link
Author

@ewpratten
Copy link
Author

This project has been moved to a GitHub repository to allow Pull Requests. See: https://github.com/Ewpratten/youtube_ad_blocklist

@bicnar
Copy link

bicnar commented Feb 5, 2021

@Totally3D very thanks y add the rules to my DNS STATIC mikrotik with dst loopback IP all its fine

@blue-pine
Copy link

It's youtube's own damn fault, they're squeezing way too tightly, I'm getting 2 ads in a row now, sometimes 2 ads in a row before video starts AND then right in the middle!

Yes same here

@jmtibbetts
Copy link

Please ADD these to your host file to block ADS on youtube all thanks

r8.sn-4g5ednzz.googlevideo.com
r8---sn-4g5ednzz.googlevideo.com
r6.sn-4g5ednll.googlevideo.com
r6.sn-4g5edney.googlevideo.com
r6.sn-4g5ednek.googlevideo.com
r6.sn-4g5ednee.googlevideo.com
r6.sn-4g5edn7e.googlevideo.com
r6.sn-4g5e6nez.googlevideo.com
r6---sn-4g5ednll.googlevideo.com
r6---sn-4g5edney.googlevideo.com
r6---sn-4g5ednek.googlevideo.com
r6---sn-4g5ednee.googlevideo.com
r6---sn-4g5edn7e.googlevideo.com
r6---sn-4g5e6nez.googlevideo.com
r5.sn-h0jeenek.googlevideo.com
r5.sn-4g5ednzz.googlevideo.com
r5.sn-4g5ednsz.googlevideo.com
r5.sn-4g5ednsy.googlevideo.com
r5.sn-4g5ednsr.googlevideo.com
r5.sn-4g5ednsl.googlevideo.com
r5.sn-4g5ednsd.googlevideo.com
r5.sn-4g5edns6.googlevideo.com
r5.sn-4g5ednly.googlevideo.com
r5.sn-4g5edn7s.googlevideo.com
r5.sn-4g5e6nzl.googlevideo.com
r5.sn-4g5e6nze.googlevideo.com
r5.sn-4g5e6nz7.googlevideo.com
r5.sn-4g5e6nsz.googlevideo.com
r5.sn-4g5e6nsy.googlevideo.com
r5.sn-4g5e6nss.googlevideo.com
r5.sn-4g5e6nsk.googlevideo.com
r5.sn-4g5e6ns7.googlevideo.com
r5.sn-4g5e6ns6.googlevideo.com
r5.sn-4g5e6nls.googlevideo.com
r5.sn-4g5e6ney.googlevideo.com
r5.sn-4g5e6n7r.googlevideo.com
r5.sn-4g5e6n7k.googlevideo.com
r5---sn-h0jeenek.googlevideo.com
r5---sn-4g5ednzz.googlevideo.com
r5---sn-4g5ednsz.googlevideo.com
r5---sn-4g5ednsy.googlevideo.com
r5---sn-4g5ednsr.googlevideo.com
r5---sn-4g5ednsl.googlevideo.com
r5---sn-4g5ednsd.googlevideo.com
r5---sn-4g5edns6.googlevideo.com
r5---sn-4g5ednly.googlevideo.com
r5---sn-4g5edn7s.googlevideo.com
r5---sn-4g5e6nzl.googlevideo.com
r5---sn-4g5e6nze.googlevideo.com
r5---sn-4g5e6nz7.googlevideo.com
r5---sn-4g5e6nsz.googlevideo.com
r5---sn-4g5e6nsy.googlevideo.com
r5---sn-4g5e6nss.googlevideo.com
r5---sn-4g5e6nsk.googlevideo.com
r5---sn-4g5e6ns7.googlevideo.com
r5---sn-4g5e6ns6.googlevideo.com
r5---sn-4g5e6nls.googlevideo.com
r5---sn-4g5e6ney.googlevideo.com
r5---sn-4g5e6n7r.googlevideo.com
r5---sn-4g5e6n7k.googlevideo.com
r4.sn-4g5ednz7.googlevideo.com
r4.sn-4g5ednsy.googlevideo.com
r4.sn-4g5ednsk.googlevideo.com
r4.sn-4g5ednsd.googlevideo.com
r4---sn-4g5ednz7.googlevideo.com
r4---sn-4g5ednsy.googlevideo.com
r4---sn-4g5ednsk.googlevideo.com
r4---sn-4g5ednsd.googlevideo.com
r3.sn-4g5ednz7.googlevideo.com
r3.sn-4g5ednss.googlevideo.com
r3.sn-4g5ednsd.googlevideo.com
r3.sn-4g5ednls.googlevideo.com
r3.sn-4g5ednll.googlevideo.com
r3.sn-4g5ednee.googlevideo.com
r3.sn-4g5edned.googlevideo.com
r3.sn-4g5edne7.googlevideo.com
r3.sn-4g5edne6.googlevideo.com
r3.sn-4g5e6nzz.googlevideo.com
r3.sn-4g5e6nzs.googlevideo.com
r3.sn-4g5e6nsz.googlevideo.com
r3.sn-4g5e6nsy.googlevideo.com
r3.sn-4g5e6nsk.googlevideo.com
r3.sn-4g5e6nle.googlevideo.com
r3.sn-4g5e6nld.googlevideo.com
r3---sn-4g5ednz7.googlevideo.com
r3---sn-4g5ednss.googlevideo.com
r3---sn-4g5ednsd.googlevideo.com
r3---sn-4g5ednls.googlevideo.com
r3---sn-4g5ednll.googlevideo.com
r3---sn-4g5ednee.googlevideo.com
r3---sn-4g5edned.googlevideo.com
r3---sn-4g5edne7.googlevideo.com
r3---sn-4g5edne6.googlevideo.com
r3---sn-4g5e6nzz.googlevideo.com
r3---sn-4g5e6nzs.googlevideo.com
r3---sn-4g5e6nsz.googlevideo.com
r3---sn-4g5e6nsy.googlevideo.com
r3---sn-4g5e6nsk.googlevideo.com
r3---sn-4g5e6nle.googlevideo.com
r3---sn-4g5e6nld.googlevideo.com
r2.sn-hp57kn6e.googlevideo.com
r2.sn-h0jeln7e.googlevideo.com
r2.sn-h0jeener.googlevideo.com
r2.sn-h0jeen76.googlevideo.com
r2.sn-4g5ednzz.googlevideo.com
r2.sn-4g5ednly.googlevideo.com
r2.sn-4g5ednls.googlevideo.com
r2.sn-4g5ednle.googlevideo.com
r2.sn-4g5ednee.googlevideo.com
r2.sn-4g5edned.googlevideo.com
r2.sn-4g5edn7y.googlevideo.com
r2.sn-4g5e6nsz.googlevideo.com
r2.sn-4g5e6nsy.googlevideo.com
r2.sn-4g5e6nsk.googlevideo.com
r2.sn-4g5e6ns6.googlevideo.com
r2.sn-4g5e6nl7.googlevideo.com
r2.sn-4g5e6ney.googlevideo.com
r2---sn-hp57kn6e.googlevideo.com
r2---sn-h0jeln7e.googlevideo.com
r2---sn-h0jeener.googlevideo.com
r2---sn-h0jeen76.googlevideo.com
r2---sn-4g5ednzz.googlevideo.com
r2---sn-4g5ednse.googlevideo.com
r2---sn-4g5ednly.googlevideo.com
r2---sn-4g5ednls.googlevideo.com
r2---sn-4g5ednle.googlevideo.com
r2---sn-4g5ednee.googlevideo.com
r2---sn-4g5edned.googlevideo.com
r2---sn-4g5edn7y.googlevideo.com
r2---sn-4g5e6nsz.googlevideo.com
r2---sn-4g5e6nsy.googlevideo.com
r2---sn-4g5e6nsk.googlevideo.com
r2---sn-4g5e6ns6.googlevideo.com
r2---sn-4g5e6nl7.googlevideo.com
r2---sn-4g5e6ney.googlevideo.com
r15.sn-4g5ednzz.googlevideo.com
r15---sn-4g5ednzz.googlevideo.com
r11.sn-4g5ednzz.googlevideo.com
r11---sn-4g5ednzz.googlevideo.com
r10.sn-4g5ednzz.googlevideo.com
r10---sn-4g5ednzz.googlevideo.com
r1.sn-h0jeln7e.googlevideo.com
r1.sn-h0jeened.googlevideo.com
r1.sn-h0jeen76.googlevideo.com
r1.sn-4g5ednsd.googlevideo.com
r1.sn-4g5ednly.googlevideo.com
r1.sn-4g5ednll.googlevideo.com
r1.sn-4g5edne6.googlevideo.com
r1.sn-4g5e6nzz.googlevideo.com
r1.sn-4g5e6nz7.googlevideo.com
r1.sn-4g5e6nsy.googlevideo.com
r1.sn-4g5e6nez.googlevideo.com
r1---sn-h0jeln7e.googlevideo.com
r1---sn-h0jeened.googlevideo.com
r1---sn-h0jeen76.googlevideo.com
r1---sn-4g5ednsd.googlevideo.com
r1---sn-4g5ednly.googlevideo.com
r1---sn-4g5ednll.googlevideo.com
r1---sn-4g5edne6.googlevideo.com
r1---sn-4g5e6nzz.googlevideo.com
r1---sn-4g5e6nz7.googlevideo.com
r1---sn-4g5e6nsy.googlevideo.com
r1---sn-4g5e6ns7.googlevideo.com
r1---sn-4g5e6nez.googlevideo.com
manifest.googlevideo.com
r8.sn-n02xgoxufvg3-2gbs.googlevideo.com
r8---sn-n02xgoxufvg3-2gbs.googlevideo.com
r6.sn-4g5edne7.googlevideo.com
r6---sn-4g5edne7.googlevideo.com
r5.sn-hp57yn7y.googlevideo.com
r5---sn-hp57yn7y.googlevideo.com
r4.sn-h0jeln7l.googlevideo.com
r4.sn-h0jeln7e.googlevideo.com
r4.sn-h0jeened.googlevideo.com
r4.sn-4g5ednzz.googlevideo.com
r4.sn-4g5edns7.googlevideo.com
r4.sn-4g5ednly.googlevideo.com
r4.sn-4g5ednld.googlevideo.com
r4.sn-4g5edney.googlevideo.com
r4.sn-4g5e6nzs.googlevideo.com
r4.sn-4g5e6ns6.googlevideo.com
r4.sn-4g5e6nez.googlevideo.com
r4---sn-h0jeln7l.googlevideo.com
r4---sn-h0jeln7e.googlevideo.com
r4---sn-h0jeened.googlevideo.com
r4---sn-4g5ednzz.googlevideo.com
r4---sn-4g5edns7.googlevideo.com
r4---sn-4g5ednly.googlevideo.com
r4---sn-4g5ednld.googlevideo.com
r4---sn-4g5edney.googlevideo.com
r4---sn-4g5e6nzs.googlevideo.com
r4---sn-4g5e6ns6.googlevideo.com
r4---sn-4g5e6nez.googlevideo.com
r3.sn-4g5ednzz.googlevideo.com
r3.sn-4g5ednsz.googlevideo.com
r3.sn-4g5edns6.googlevideo.com
r3.sn-4g5ednld.googlevideo.com
r3.sn-4g5e6nsr.googlevideo.com
r3.sn-4g5e6nl7.googlevideo.com
r3---sn-4g5ednzz.googlevideo.com
r3---sn-4g5ednsz.googlevideo.com
r3---sn-4g5edns6.googlevideo.com
r3---sn-4g5ednld.googlevideo.com
r3---sn-4g5e6nsr.googlevideo.com
r3---sn-4g5e6nl7.googlevideo.com
r2.sn-4g5ednse.googlevideo.com
r2.sn-4g5ednld.googlevideo.com
r2.sn-4g5e6nzl.googlevideo.com
r2.sn-4g5e6nez.googlevideo.com
r2---sn-4g5ednld.googlevideo.com
r2---sn-4g5e6nzl.googlevideo.com
r2---sn-4g5e6nez.googlevideo.com
r1.sn-4g5ednsr.googlevideo.com
r1.sn-4g5ednsl.googlevideo.com
r1.sn-4g5ednse.googlevideo.com
r1.sn-4g5edned.googlevideo.com
r1.sn-4g5e6ns7.googlevideo.com
r1.sn-4g5e6ns6.googlevideo.com
r1.sn-4g5e6nl6.googlevideo.com
r1.sn-4g5e6ne6.googlevideo.com
r1---sn-4g5ednsr.googlevideo.com
r1---sn-4g5ednsl.googlevideo.com
r1---sn-4g5ednse.googlevideo.com
r1---sn-4g5edned.googlevideo.com
r1---sn-4g5e6ns6.googlevideo.com
r1---sn-4g5e6nl6.googlevideo.com
r1---sn-4g5e6ne6.googlevideo.com

or just use regex if you can:
(.|^)googlevideo.com$

@ewpratten
Copy link
Author

@jmtibbetts Please open this as an issue in the new repository.

https://github.com/Ewpratten/youtube_ad_blocklist

@AryanGitHub
Copy link

hi, can I ask why https://ewpratten.retrylife.ca/youtube_ad_blocklist/hosts.ipv6.txt is shown as malware (Trojan.Win32.Hosts2.gen) by Kaspersky.

@GunGunGun
Copy link

hi, can I ask why https://ewpratten.retrylife.ca/youtube_ad_blocklist/hosts.ipv6.txt is shown as malware (Trojan.Win32.Hosts2.gen) by Kaspersky.

Because they dislike hosts files as host files can redirect users to unknown host, but it's false positive in this case.

@ewpratten Anyway, did you stopped updating this project and youtube adblocklist ?

@krystian3w
Copy link

This repository has been archived by the owner before Nov 9, 2022. It is now read-only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment