Going To Extremes To Block YouTube Ads

Many users of YouTube feel that the quality of the service has been decreasing in recent years — the platform offers up bizarre recommendations, fails to provide relevant search results, and continues to shove an increasing amount of ads into the videos themselves. For shareholders of Google’s parent company, though, this is a feature and not a bug; and since shareholder opinion is valued much more highly than user opinion, the user experience will likely continue to decline. But if you’re willing to put a bit of effort in you can stop a large chunk of YouTube ads from making it to your own computers and smartphones.

[Eric] is setting up this adblocking system on his entire network, so running something like Pi-hole on a single-board computer wouldn’t have the performance needed. Instead, he’s installing the pfSense router software on a mini PC. To start, [Eric] sets up a pretty effective generic adblocker in pfSense to replace his Pi-hole, which does an excellent job, but YouTube is a different beast when it comes to serving ads especially on Android and iOS apps. One initial attempt to at least reduce ads was to subtly send YouTube traffic through a VPN to a country with fewer ads, in this case Italy, but this solution didn’t pan out long-term.

A few other false starts later, all of which are documented in detail by [Eric] for those following along, and eventually he settled on a solution which is effectively a man-in-the-middle attack between any device on his network and the Google ad servers. His router is still not powerful enough to decode this information on the fly but his trick to get around that is to effectively corrupt the incoming advertising data with a few bad bytes so they aren’t able to be displayed on any devices on the network. It’s an effective and unique solution, and one that Google hopefully won’t be able to patch anytime soon. There are some other ways to improve the miserable stock YouTube experience that we have seen as well, like bringing back the dislike button.

Thanks to [Jack] for the tip!

103 thoughts on “Going To Extremes To Block YouTube Ads

    1. Yeah, am I going crazy or something? I just run two of those on Firefox (ublock, noscript) and I haven’t seen a youtube ad in years. Not even on my phone, thanks to firefox mobile supporting ublock. And youtube hasn’t banned me for ad dodging either.
      (Note that firefox on mobile + extensions lets you do this on mobile out in the wild as well)
      Do people simply tolerate the constant ads? Can they not figure out a couple google searches ending up at forum threads teaching you how to use a proper adblock? I forgot that youtube was even supposed to have ads at all

      1. At least on mobile, I think a lot of people just forget you can still watch videos in the browser rather than the YT app (where ads are much more work to block), especially when the big YT app icon is there by default. I’ve definitely known people who use a mobile browser with an adblocker but cursed about ads whenever they watch YT, because they left the browser.

        I think at least on my Android, the default setting was also for Firefox to bounce YT links straight to the app rather than opening them in the browser, so it’s ingrained from the start, “YT videos only go in the YT app, after this two-minute ad”.

      2. I’m also on Firefox and uBlock Origin + SponsorBlock are sufficient to block everything Youtube can throw at me. That includes the mobile version of Firefox on Android, btw., because uBlock also runs on there.

        Chrome users may have a more difficult time, what with Google deprecating features that adblockers need to work effectively.

        And yes, other people simply tolerate ads. Or buy premium. My girlfriend is firmly in the former camp and it drives me nuts. If my only two choices were to watch the ads or pay for premium, I’d simply go do something else.

        1. I’m running firefox with ublock origin as well yet i still get youtube’s anti-ad blocker screen on every video. I’ve tried various things but nothing has worked so far so either YT is improving everyday, or i’m missing something very obvious.

      3. Google have recently done something to Chrome that makes ads play even though you’re running uBlock. They’ve also effectively sabotaged Firefox – the site loads extremely slowly, especially if you’re opening tabs in the background, and videos will start playing at 480p or even lower resolutions. Shorts will look like a Lego block animation.

      4. Firefox.. Between ublock-origin and adblocker+ , and Pi-Hole, we haven’t seen ads in you-tube for years… That is expect those sponsor ads that the talker inserts into his dialog (which just skip ahead).

        I would ‘dump’ using you-tube if I had to sit thru all those ads (like you’d do if you had a antique television in your house ;) ) . If adverts would just put a plain ad on the side (no embedded video, no flashing gif) I wouldn’t mind. Like reading a newspaper, you can just scan over them.

        1. Should add, our phones are used 99% of the time for just phone, text, and occasional picture. The internet app is ‘rarely’ used (that goes for 99% of the apps that a phone comes with actually) and never for movies and such say on you-tube.

      5. I tolerate reasonable ads, 30 seconds now and then with plenty of uninterrupted minutes of video. But when Youtube started shoving long unskippable ads, I drew the line. No one needs a 2 hours long ad for a 20 seconds cat video!!

        I haven’t seen Youtube ad in years thanks to their tendency to have unreasonably long unskippable ads. If only Google knew how to enforce limit and make long ones skippable and not let 3rd party dictate ad rules…

  1. ” For shareholders of Google’s parent company, though, this is a feature and not a bug; and since shareholder opinion is valued much more highly than user opinion, the user experience will likely continue to decline.”

    So shareholders don’t use Youtube then?

  2. I use the SmartTube Next app for my Android TV, which is amazing. It comes with SponsorBlock built in, too. My YouTube experience has increased vastly since installing that.

    Unfortunately there’s no equivalent for iOS/tvOS, so I’m still stuck getting obnoxious ads on my iPad and iPhone.

    1. There is Vinegar, which replaces the youtube player with a minimal HTML player in Safari and that gets rid of all the ads in youtube vids. I have an old Apple TV so i can use Apple airplay from my iPhone to watch youtube vids without ads on the bigscreen.

  3. What a documentation! Amazing work!

    “Google returns huge responses in Protobuf (e.g. 1.8 MiB) – including even the layout of the iOS app – so only C++/Swift is fast enough to understand it all before the connection times out. I’ve shown that Python is several orders of magnitude too slow in decoding these Protobuf payloads, so connections do time out waiting on Python. ”

    That makes my cold cold heart a bit warm.

  4. I haven’t seen a single yousnooz ad in years. Not exactly rocket science. Firefox with adblockers is all it took.

    Selling that as a major revelation is kind of … anachronistic?

    1. > I haven’t seen a single yousnooz ad in years. Not exactly rocket science. Firefox with adblockers is all it took.

      Blocking ads on an app you control, like a pc-based browser, is dead simple. The author of the article notes that, rather unsurprisingly.

      The problem comes when you try to use YT on locked-down devices – iOS, Android, game consoles like Nintendo Switch, Xbox, PS, etc. You’re not using a web browser for YT on these platforms for the most part. Yes, you can use YT on mobile devices with a browser, with some success. But even then, as has been noted by some commenters above, blocking ads on Android had been a mixed bag, given that Google has specifically been making it difficult.

      So, what do you do when you can’t simply install a plug-in to block ads? After all, that’s why ublock works while pihole fails – YT’s ads come from the same domain as their videos, and only inspecting TLS traffic will let you separate garbage content from … well, presumably non-garbage. :)

      Believe it or not, that’s what the above article addresses – how to block YT ads on devices where you can’t simply install ublock on a web browser. Like ublock, the author discovered he needs to inspect TLS traffic, but since he doesn’t have the luxury of letting the browser or app do it for him, he had to use a man-in-the-middle proxy to do it, tied into pfsense for blocking.

      Of course, you know all of this already, since you read the article before commenting, right? Surely you wouldn’t waste time posting snarky comments about something you didn’t read – after all, it’s not rocket science! :P

      1. I love the dripping sarcasm towards the end.

        You are right, I didn’t read the article in all of its glorious detail. In particular I missed the part that this is about platforms that feed everything its users do to opaque places for analysis.

        Using locked down devices for many day-to-day activities is something I avoid studiously, mainly to maintain what little privacy I have left. And to keep them ad-algorithms guessing.

        1. > I love the dripping sarcasm towards the end.

          Thanks! ;)

          > Using locked down devices for many day-to-day activities is something I avoid studiously, mainly to maintain what little privacy I have left.

          Believe me, so so I.

          But I’m a parent of two under-10-yos. They have tablets, they use game consoles, and yes, they watch game-based YouTubers.

          Alas, the game consoles and their tablets aren’t able to avoid YT’s ad blitz. To that end, I’ve been considering investigating what I can do with mitmproxy… and the above article gives me a pretty good idea of what obstacles I’d face in doing so. That’s useful to me. I realize it’s not necessarily useful to *you*, but at least some people can benefit from it, right?

          After all, that’s why HaD exists, right? They don’t publish information useful to 100% of their readers, but at least some portion can presumably find their articles of some use at any given time.

          1. I solved the same problem for the various i-devices using Kidslox and a VPN that filters.

            Plus kids only get to use a VLAN that has filtering on DNS, which fails lookups for a lot of the undesirable stuff.

  5. Blocking ads is illegal and immoral — it’s stealing from both the ad hosters and the companies that pay money to show you their product. You should reconsider posting articles like these because they’re essentially just instructions on how to be a theif and a parasite.

    1. It’s as much stealing as it is to go to the toilet / make a cup of beverage whilst the ads are on on your linear TV. Even better is when you sync your bladder to the programming segments so every break becomes toilet + drink refill.

      In the old days, ads would be non intrusive, displayed somewhere statically on the page. Now they’re flashing, move with the page, play sounds, embed malware, cover the page. No thanks.

    2. That reminds me of the 1970s when video recorders became affordable for the home user. The advertising industry shit their pants, because viewers could skip commercials on playback. IIRC in some countries they even wanted to ban VCRs. It didn’t work out and they were laughed at.
      Nowadays ads in electronic media steal personal data and energy from their targets.

        1. Instead, people would pay for youtube, and save money on the products that no longer need to budget for advertising. All in all, it would be more efficient, and therefore cheaper.

        2. No, Google owns YT, so they would continue to operate it using data-mining profits, even if at a loss, much like how Amazon operated its sales/delivery service at a loss just to choke out competition.

        3. Youtube has never made money. It’s their testing ground for products and services. The fact that they’re trying to find a way around adblickers means that they’re gonna start putting intrusive ads into their more important products soon.

    3. They may be against your moral code, as morals are subjective, but it is objectively not illegal. There is no law anywhere that says I am not allowed to decline to view someone else’s content when they stream it to my device.

      My device, my rules. Ads on my device violate the terms and conditions I set for existing on my device, so I remove them. It is immoral to try to control what I do with my own device.

      1. “My device, my rules. Ads on my device violate the terms and conditions I set for existing on my device, so I remove them. It is immoral to try to control what I do with my own device.”

        THIS !

    4. It’s the advertisers that are parasites. I gladly block them all. Some youtubers I fund through Patreon but in general I prefer to help make ads unviable as a revenue source. Let’s replace them with something sustainable and honest.

      Brave is pretty good, but a recent change to youtube has allowed some through. The sooner I find a soltuion to that, the better.

      One good solution would be to throw away the youtube front page and replace it with an interface that does render’s google’s page internally but presents the user with a sanitised and customised list. It could filter out the recent spate of ads-as-content and anything with keywords such as ‘shocked’, ‘try not to’ and videos you’ve already watched (unless you’re looking for them specifically). There’s a whole lot of useful features such a filter could add.

    5. Advertising on the Internet is considered a parasitic, and worse, a security issue. They are even illegal is most countries as they do not follow media advertising rules (which are quite strict in some countries). For example I see advertisment on banned product (like Glyphosate, which is banned for public selling here).
      So this is totally legit to block them, unless Ad company do their homework.

      1. It is legal to block ads, just as it’s legal to throw printed ad mail in the trash unopened or rip out the ads from a newspaper. In many civilized countries, governmental institutions even recommend installing ad blockers to protect privacy.
        The ad industry has always been whining about lost revenue due their blurb not reaching all targets. Every time a clever guy came up with a new way to block or mute ads on radio and TV, words like the OP wrote were used, followed by a digitus impudicus from everyone else.

    6. YouTube is stealing my valuable time. Okay, I can pay them not to, but that sure feels like extortion to me. I used listen to YT Music under the shower, via a waterproof Bluetooth speaker.

      I don’t mind the occasional ad. But then there was the tipping point, when YT, with me out of reach of the phone (under the shower), forced a 20 minute ad on me (can’t skip the ad while under the shower…). The ad is question was for an MLM scam (aka Pyramid Scheme). Yes, YT obviously thinks that stealing and being immoral is so okay that they promote it!

      No, I don’t pay 12€/month for a few minutes of listening pleasure under the shower.

      There are few good local radio stations around; these play ads at certain, pre-determined times so you can plan your shower accordingly. And even if I get an ad, it’s pretty short and not for scams. Okay, they did have ads for some place where you can have a good time with ladies of negotiable affection (I guess YT is too squeaky clean for that, so they stick to scams), but the wording was SFW so what.

      In either case no money for YT.

      But considering that YouTube promotes crime and immorality (I’m talking about their ads only; not about regular scammer videos (which get interrupted by paid ads for other scams…)), I think it’s time embrace the YouTube “morality”.

    7. Can you show me any law that forbids blocking ads? Immoral? The way ad companies like google (= youtube) treat viewers and content creators so badly isn’t immoral? I can decide what to do with my time. I gladly pay for a good service and good content. I do that for other services already but the way YT treats people is just disgusting and the app experience is bad. I won’t pay for that. I pay the content creators sometimes through other means, which incidentally is much more profitable for the content creator since YT take a huge slice of the cake, and increasingly so to fill the pockets of the stakeholders.
      It’s their choice for their monetization scheme, I don’t feel obligated to pay (time wise or real money) for whatever they think is reasonable or right because it isn’t.

    8. > the companies that pay money to show you their product

      You mean, the customers of those companies who end up paying for all the adverts in the prices of the products?

      Ad-funded services are immoral, since they bait one person to consume a “free” service and use that excuse to make other people to pay for it. The more you consume this “content”, the more other people pay. The fact that you’re watching youtube videos without blocking the ads means I’m paying more for the bread I eat – because it all comes around in the economy and the cost of this pointless advertising is directly added to the cost of running the society – it’s very clever freeloading.

      1. Think about it. If you see a billboard with an ad of “pepsi” or “coke” on it, that only depends on which one paid more to plaster their ad on that billboard. If you were being rational, you would buy the brand that didn’t pay to advertise – not the one you see on the billboard – because then you wouldn’t be paying the cost of the advert.

    9. Not anymore. Now YouTube is full of shit masquerading as ads that runs INDEFINITELY. I will tolerate regular ads because I’m typically doing something like cooking while having YouTube on. But now an ad will come on, and five minutes later you realize the thing is still going. Or, bafflingly, it’s an entire MUSIC VIDEO that does not even appear to be an ad.

      So now to watch something on YouTube, you have to baby-sit and herd it along every few minutes or the video you’re watching just stops. Screw that. I’m watching on an Nvidia Shield (Android TV) so now I have to find away around this BS.

    10. So you have no problem watching the whole 2 hours long unskippable ad to watch a 20 seconds cat being silly video?

      I don’t mind ads if they were short (30s or less) and didn’t come up excessively during long video. If you grew up before cable TV and satellite and watched TV over the air, those length and amount of ads were fine with me. Youtube broke that with ads that are longer than video or multiple ads showing up in a short time.

    11. Blocking an ad isn’t stealing at all. What are you stealing? It can only be used in reverse. Ads are stealing your time. So the only thieves are the people showing you the ad. The ones making them are the parasites.

      By blocking an ad, you prevent them from stealing your time from you.

      The only moral thing to do is making sure every device you own has ad-blockers on.

    12. Hey Tim, it’s illegal for you to not read my comment, if what you’re saying is true. If you don’t read my comment, you’re going to jail. The police are already on their way. Wee woo wee woo 🤡

  6. youtube is shit now, I used to have youtube on a third screen at work for music but it play almost as much add as music if I try that, I completely stopped using youtube for that, I just download the video I need and watch them locally…

      1. A new twist you should be aware of, in the US at least, youtube has started a slow rollout blocking browsers with an adblocker installed, regardless of settings or having a premium subscription.
        I just canceled my premium because of this, as I am now blocked completely from accessing youtube. They are demanding I uninstall the plugin, which I refuse to do.

        Until they announce they are reversing course on this feature, now is the worst time to recommend buying premium.

  7. Started reading and thought meh when you didn’t cover dns over https blocking whilst discussing DNS blocks, but the more I read the more you blew my mind !!

    I have uBlock and it works with everything.
    People who think that internet = mobile phones (which is sadly where everyone is forcing us with apps) need to suffer the ads.

  8. No one even mentioned using the hosts file.
    Go give Steven Black’s host file a try. What are ads anyway, I never see them unless the youtuber themselves present products. Then it’s VCR days again and click-fast forward and they are gone. 99% of the websites function just fine without any adds at all. Call me a parasite, scold me for steeling,, chastize me for not thinking the way you do it’s my computer and my choice of time wasting. To reverse the way it goes, if the industry does not care what a single person thinks, why should I care what the industry thinks?

    1. *shrug* Best way to figure out what’s the best course of action. Do something emass, and be honest with oneself about the resulting consequences. Are they something one can live with? Great! If not, well too late, tipping points reached.

  9. I know this is controversial, but I just pay for the family plan. It’s actually good value, especially if you compare it to say Cable or streaming services. Also I can use YouTube music and save videos to watch on the go. The $70+ I save on my mobile data is more than enough to cover it.

  10. I just pay for YouTube Premium. Works on every platform, 100% reliable and takes none of my time to maintain. Also comes with YouTube Music for free. Best money I’ve ever spent.

    1. So now youtube and thus google has your name your adrress your bank account your IP and your viewing habits and everything you do on any site with google tie-in.
      Sounds like a dream, where do I sign up?

  11. I use Vivaldi browser, it has a pretty good integrated ad blocker, however on the phone i use the default app, and damn, have they been abusing on ad quantity latelly, also ads fill half of the screen all the time, it’s so bad.

  12. Apple is now kindly using ipv6 vpn tunnels to bypass your dns and back door bad servers when it can’t resolve them on your network. Blocking ipv6 on your network? No problem, apple has a work around for that and apple serves it’s own ipv6 to your ios devices through the apple network it constantly connects to.

  13. It most definitely is NOT illegal to block ads, and whether or not it’s immoral is purely a matter of opinion. I don’t mind supporting individual creators, but on principle I won’t give google a single red cent.

    Google is a member of the world wide web consortium, which states the following:

    “2.12 People should be able to render web content as they want

    People must be able to change web pages according to their needs. For example, people should be able to install style sheets, assistive browser extensions, and blockers of unwanted content or scripts or auto-played videos. We will build features and write specifications that respect peoples’ agency, and will create user agents to represent those preferences on the web user’s behalf.” So in my opinion what they’re doing here is absolutely hypocritical and borderline unethical.

    1. What I don’t get why is everyone who refuses to pay for premium so pissed off? They give you an option to not see ads but no it costs to much or whatever. But the service costs money to run so what is the alternative?
      So obviously being paid doesn’t work cause well look at this thread about people blocking the ads, free with ads doesn’t work cause of the ads. Like WTF it seems everyone just wants it for free. Which I get I’m one of those but at least I know it costs money to actually run something like youtube I just don’t care.

      1. per the internet YT made over 29 billion dollars last year with everyone using adblockers. How exactly do you think they made all that money without us watching their ads? Here’s a hint any info you gave them they sold to every company on the planet that buys it. So they don’t actually need ad revenue from YT to keep the service running.

        But more importantly I started to use an adblocker last year and not for the 15 years prior (estimated don’t remember exactly when I started using it). I didn’t use it because 30-45 seconds before a video was fine, still a-lot better than watching an NFL game. Now they are running 5 minutes or more of ads for a 10 minute video which is beyond ridiculous. Playing Ads in the middle of a music video is beyond mentally ill not to mention completely disrespectful to the performer.

        Now the ad-blockers are not working so instead of doing a bunch of work I simply won’t waste my time on you tube. I feel bad for the creators that I do watch (which are few and far between to begin with). I suppose they will end up moving to a better provider for their services eventually.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.