Live data from Hacker News

YouTube ads in Safari: you see them now, will you see them in the future?

adguard.com

181–190 of 282 posts

Re: YouTube ads in Safari: you see them now, will you see them in the future?

#182

Earlier quoted context omitted.

Frankly I just hate the idea of YouTube creators getting paid for their work. /s

Youtube shows ads on videos for a section of creators without paying them and also puts ads on creator's videos that do not want ads on them.

Yes, recently they have also sent an email regarding this change and other changes in their policy.

Even after all these measures, are they even making any profit yet?

Re: YouTube ads in Safari: you see them now, will you see them in the future?

#183
post #68

Has anyone used iOS browsers with adblocking built in? How do Firefox and Brave compare to Adguard or 1BlockerX? Any other browsers out there that do a better job?

I’ve been trying Brave this week and unfortunately it performed absolutely uselessly on some busy websites, locking up for *several seconds* every time I open a new tab. It might be a temporary bug, but I moved to DDG as my secondary browser anyway. Safari and DDG handle those same pages effortlessly.

Which sites are causing issues?

Re: YouTube ads in Safari: you see them now, will you see them in the future?

#184

The battle between ad platforms and users is going to be never ending. For YouTube, the _right_ thing to do is to pay for the premium option which removes ads. Otherwise as difficult as it is to say, you are getting something for nothing and people do make a living from YouTube videos. Ok, maybe you can contribute to a patreon outside of YouTube, but you’re not going to do that for everyone and those videos are not s…

I watch YouTube on my TV and the ads are annoying enough that I actually looked into subscribing to YouTube Premium to make the ads go away (and better support the content creators I follow). But I'm not ready to pay YouTube $12/month just to make ads go away. I would probably pay $5/month. Netflix's basic plan only costs $9/month.

> I actually looked into subscribing to YouTube Premium to make the ads go away

Please don't; this gives money to (and thus rewards and encourages) advertisers; use something like http://youtube-dl.org/ instead.

Re: YouTube ads in Safari: you see them now, will you see them in the future?

#185

Earlier quoted context omitted.

If we go down that road, however, sites can make ads completely indistinguishable from desired content. Same domain, same stream, no easily marked container. All of the imperative adblocking tech in the world, short of queuing everything through a neural engine post render, can block what is possible. So there has always been a detente between adblockers and publishers, presuming the former hit a small enough set of…

That would require delivering ads from first-party servers, right? So third-party ad and tracking networks would die a painful death.

...That's what YouTube does. Ad video content comes from redirector.gvt.com -> xxx.googlevideo.com just like solicited video content.

(Yes, I classify advertising as spam.)

Re: YouTube ads in Safari: you see them now, will you see them in the future?

#186
post #58

Earlier quoted context omitted.

This is basically the exact fear which was being expressed by users when Google announced that they would require Chrome extensions to only use declarative content blocking starting with Manifest v3 (which anecdotally convinced me to switch to Firefox).

If we go down that road, however, sites can make ads completely indistinguishable from desired content. Same domain, same stream, no easily marked container. All of the imperative adblocking tech in the world, short of queuing everything through a neural engine post render, can block what is possible. So there has always been a detente between adblockers and publishers, presuming the former hit a small enough set of…

> If we go down that road, however, sites can make ads completely indistinguishable from desired content.

This is exactly the reason why I'm building a web browser with a statistical representation of both the DOM/CSS Layout _and_ the network traffic, so that neural networks can be trained on classifying ads and malicious actors.

There's a lot of requirements in regards of networking for such a peer-to-peer system to work, like a consensus on DNS/CNAME/PTR or consensus on TLS cert validity.

But I honestly believe that this is inavoidable in the near future, given that most Browsers these days are just a Chrome/Chromium shim where obviously Google's business model conflicts with the idea of blocking ads.

Re: YouTube ads in Safari: you see them now, will you see them in the future?

#187

Earlier quoted context omitted.

Some trackers are having people setup CNAME records on their domains, so the tracker cookies appear to be first party: https://arxiv.org/abs/2102.09301

uBlock Origin already performs CNAME decloaking and blocks this approach, it’s pretty cool.

> uBlock Origin already performs CNAME decloaking and blocks this approach, it’s pretty cool.

... which in return is a static list of domains which needs to be regularly updated, and therefore is not really failsafe. uBlock0 uses Adguard's scraped dataset [1] as a fallback source to do this, as Chrome Extensions cannot make DNS requests without a DNS-via-HTTPS endpoint.

Firefox, however, has provided the `dns` API [2] to do requests via the native OS resolver (which in return is also not failsafe due to being unencrypted plain-old-manipulateable DNS UDP requests)

[1] https://github.com/AdguardTeam/cname-trackers

[2] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web...

Re: YouTube ads in Safari: you see them now, will you see them in the future?

#189
Maybe slightly tangential since this is about Safari - but have 𝗬𝗼𝘂𝗧𝘂𝗯𝗲 𝗮𝗱𝘀 𝗿𝗲𝗰𝗲𝗻𝘁𝗹𝘆 𝗿𝗲𝗮𝗽𝗽𝗲𝗮𝗿𝗲𝗱 𝗶𝗻 𝗖𝗵𝗿𝗼𝗺𝗲?

The declarativeWebRequest YouTube adblocker I threw together in half an hour a few months ago recently stopped working on my end too.

Opting out of targeted ads serves you the bottom of the barrel, which was enough motivation to waste a day of JS spelunking (YouTube's changes "conveniently" make declarative blocking nonviable).

Here's what works for me... and here's hoping it still works tomorrow :)

  ▶ manifest.json:
  {
    "name": "ytadblock",
    "description": "(license: CC0)",
    "version": "2.0",
    "manifest_version": 2,
    "declarative_net_request": {
      "rule_resources": [{
        "id": "1", "enabled": true, "path": "ytadblock.json"
      }]
    },
    "permissions": [
      "declarativeNetRequest",
      "*://youtube.com/*",
      "*://www.youtube.com/*"
    ],
    "content_scripts": [
      {
        "matches": ["https://*.youtube.com/*"],
        "js": ["contentscript.js"],
        "run_at": "document_start"
      }
    ],
    "web_accessible_resources": ["inject.js"]
  }

  ▶ ytadblock.json:
  [{
    "id": 1,
    "priority": 1,
    "action": { "type": "block" },
    "condition": {
      "regexFilter": ".*\\.googlevideo\\.com/.*ctier=",
      "resourceTypes": [
        "main_frame", "sub_frame", "script", "image", "xmlhttprequest", "media", "other"
      ]
    }
  }]

  ▶ contentscript.js:
  console.log('hi from contentscript');
  var s = document.createElement('script');
  s.src = chrome.runtime.getURL('inject.js');
  s.onload = function() { this.remove(); }
  document.documentElement.prepend(s);

  ▶ inject.js:
  'use strict';
  (function() {
    var parse = JSON.parse;
    JSON.parse = function(input) {
      var data = parse(input);
      if (typeof data['playerResponse'] !== 'undefined') {
        data.playerResponse.adPlacements = [];
        data.playerResponse.playerAds = [];
      }
      return data;
    }
    var fetch_ = fetch;
    fetch = async function(...args) {
      let response = await fetch_(...args);
      let text = await response.text();
      if (response.url.match(/\/player\?/)) {
        try {
          var json = JSON.parse(text);
          if (typeof json['playerAds'] !== 'undefined') {
            json.adPlacements = [];
            json.playerAds = [];
          }
          text = JSON.stringify(json);
        } catch (e) {}
      }
      return new Response(text, {
        status: response.status,
        statusText: response.statusText,
        headers: response.headers
      });
    };
    var trap = {
      get(target, key) {
        if (key == 'create' || key == 'createAlternate') {
          return function(...args) {
            args[1].args.raw_player_response.adPlacements = [];
            args[1].args.raw_player_response.playerAds = [];
            return target[key](...args);
          }
        } else if (typeof target[key] === 'object' && (key == 'player' || key == 'Application')) {
          return new Proxy(target[key], trap);
        } else {
          return target[key];
        }
      }
    };
    var yt = new Proxy({}, trap);
  })();
Notes:

- Ad video requests can actually be distinguished by the "ctier" parameter in the xxx.googlevideo.com URL. (I presume "c" is related to the "CSI" that seems to be everywhere on Google properties.) The sole declarative block is intended as a fallback in case the JavaScript hooks fail; you'll know if you hit these, because ad videos will spin for 5 seconds before they fail - and there might be MoRe ThAn OnE - and this may drive you very, very crazy. :)

- Initial page loads now contain a JavaScript blob with content and ad video info. After a lot of stumbling around I got the idea to turn the `yt` object into a Proxy and intercept the yt.player.Application.createAlternate() function, which said blob is passed into as an argument.

- YouTube seems to be using a mixture of requests to ".../player?" via Fetch and XHR POSTed requests to ".../watch?.*pbj=1" to fetch next-video-info when you click video links. Hooking XHR proved... depressingly tricky (...wow...), so I got the idea from https://greasyfork.org/en/scripts/32626-disable-youtube-vide... to hook JSON.parse instead (koooool). Hooking Fetch, or at least YouTube's use of Fetch, was thankfully not that hard.

The above is quite brittle, depends on how YouTube works now, and may get caught in the crossfire of unrelated site changes. ¯\_(ツ)_/¯*

Re: YouTube ads in Safari: you see them now, will you see them in the future?

#190
post #188

This one single problem is why I switched to Firefox. Even the FF mobile app does a much better job.

You can't switch to Firefox on iOS. It's Safari,or Safari with Firefox' UI. Apple forbids other web browser engines on iOS.
Post reply on HN