Project

General

Profile

Actions

Bug #909

open

Block ads in YouTube videos

Added by Thomas Jensen 4 months ago. Updated 3 months ago.

Status:
New
Priority:
4.x
Start date:
10/09/2022
Due date:
% Done:

0%

Estimated time:

Description

Privacy Browser doesn't block ads in youtube videos. Opera Browser for android does, and firefox (with adblockers) on my pc does. Is it possible to make Privacy Browser also block these ads?

Actions #1

Updated by Soren Stoutner 4 months ago

  • Tracker changed from Feature to Bug
  • Assignee set to Soren Stoutner

I think the core of the problem is that Google is constantly changing the URLs that deliver the ads. Currently, Privacy Browser only updates the blocklists with new releases. There is a planned feature to allow for the automatic update of the blocklists.

https://redmine.stoutner.com/issues/182

My guess is that the issue will be resolved when that is in place, but I will leave this bug report open in case there is something else that is needed.

The following two feature requests could also be of interest to this issue:

https://redmine.stoutner.com/issues/180
https://redmine.stoutner.com/issues/181

Actions #2

Updated by Thomas Jensen 4 months ago

Soren Stoutner wrote in #note-1:

Currently, Privacy Browser only updates the blocklists with new releases.

I am not sure update of blocklists is the problem. If you want to, you could report the issue here: https://github.com/easylist/easylist/issues, and maybe they will help you.

Actions #3

Updated by Soren Stoutner 4 months ago

You may be right. This could be a general deficiency in EasyList, instead of just a changing URL issue. I am unlikely to have the time to chase this down right now as I am spending all of my available time building Privacy Browser PC and won't have the time to investigate the root cause until Privacy Browser PC reaches feature parity with Privacy Browser Android. However, if you would like it done more quickly you can submit an bug to EasyList (or better yet, just describe the problem or submit the fix on their forum at https://forums.lanik.us/viewforum.php?f=62&sid=03362ad10a7f79f247f6a37545a115f0 which is their preferred method of communication) and test it out to make sure it works. Then it will flow into Privacy Browser the next time an update is released.

Actions #4

Updated by Soren Stoutner 3 months ago

  • Subject changed from Blocking ads in youtube videos to Block ads in YouTube videos
  • Priority changed from 3.x to 4.x

I decided to spend some time today trying to narrow down the problem. It turns out that YouTube ads can only be blocked by modifying the JavaScript and JSON on the page.

Specifically, these are the lines in the uBlock filters that do the trick:

youtube.com,youtubekids.com,youtube-nocookie.com##+js(json-prune, [].playerResponse.adPlacements [].playerResponse.playerAds playerResponse.adPlacements playerResponse.playerAds adPlacements playerAds)
youtube.com,youtubekids.com,youtube-nocookie.com##+js(set, ytInitialPlayerResponse.adPlacements, undefined)
youtube.com,youtubekids.com,youtube-nocookie.com##+js(set, playerResponse.adPlacements, undefined)

The EasyList ad blocking specification does not provide options for modifying JavaScript and JSON. Which is why, if you are running uBlock origin and only enable EasyList and lists that use their specification, it will not block ads on YouTube.

Additionally, the controls that Andorid's WebView provides in this regard are fairly limited, and it would likely not be possible to implement the uBlock specification. That restriction could change with the release of Privacy WebView in the 4.x series.

In the meantime, NewPipe (https://newpipe.net/) does a good job of playing videos from YouTube without showing the ads. If you have NewPipe set as your default YouTube player and visit a YouTube page in Privacy Browser, you can automatically open the video in NewPipe from the options menu by tapping Share > Open with App.

Actions #5

Updated by राही अखेराजोत 3 months ago

https://piped.kavin.rocks/ [requires javascript]
https://yewtu.be/ [without javascript]
are good alternatives to YouTube that does not contain ads and analytics.

Actions #6

Updated by Soren Stoutner 3 months ago

yewtu.be is pretty cool! In today's HTML 5 world, there is really no excuse to require JavaScript to play videos.

And, as with all things cool, it is actually a federated service:

https://redirect.invidious.io/watch?v=a-El3Ych3hI

Actions

Also available in: Atom PDF