Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Ads on YT #10241

Closed
SergeyZhukovsky opened this issue Jun 12, 2020 · 2 comments · Fixed by brave/brave-core#5860
Closed

[Android] Ads on YT #10241

SergeyZhukovsky opened this issue Jun 12, 2020 · 2 comments · Fixed by brave/brave-core#5860

Comments

@SergeyZhukovsky
Copy link
Member

SergeyZhukovsky commented Jun 12, 2020

Description

There are ads on YT sometimes, we need to inject that script to prevent them
(function() { const prunePaths = ['playerResponse.adPlacements', 'playerResponse.playerAds', 'adPlacements', 'playerAds']; const findOwner = function(root, path) { let owner = root; let chain = path; for (;;) { if ( owner instanceof Object === false ) { return; } const pos = chain.indexOf('.'); if ( pos === -1 ) { return owner.hasOwnProperty(chain)? [ owner, chain ]: undefined; } const prop = chain.slice(0, pos); if ( owner.hasOwnProperty(prop) === false ) { return; } owner = owner[prop]; chain = chain.slice(pos + 1); } }; JSON.parse = new Proxy(JSON.parse, { apply: function() { const r = Reflect.apply(...arguments); for ( const path of prunePaths ) { const details = findOwner(r, path); if ( details !== undefined ) { delete details[0][details[1]]; } } return r; }, }); })();

We need to do it in that place
https://github.com/brave/brave-core/blob/master/browser/android/preferences/background_video_playback_tab_helper.cc

Steps to reproduce

Unfortunately I haven't found any video with ads before the fix. Maybe @antonok-edm has ideas on how to verify it properly.
Background video playback functionality should be also checked as there were modifications in that place.

Actual result

Users complain about ads on YouTube

Expected result

No ads on YouTube

Issue reproduces how often

No steps to reproduce

Issue happens on

  • Current Play Store version? Yes
  • Beta build? Unknown, most likely yes

Device details

  • Install type (ARM, x86):
  • Device (Phone, Tablet, Phablet):
  • Android version:

Brave version

Website problems only

  • Does the issue resolve itself when disabling Brave Shields?
  • Does the issue resolve itself when disabling Brave Rewards?
  • Is the issue reproducible on the latest version of Chrome?

Additional information

@SergeyZhukovsky SergeyZhukovsky added bug OS/Android Fixes related to Android browser functionality labels Jun 12, 2020
@SergeyZhukovsky SergeyZhukovsky self-assigned this Jun 16, 2020
@SergeyZhukovsky SergeyZhukovsky added this to the 1.12.x - Nightly milestone Jun 16, 2020
@antonok-edm
Copy link
Collaborator

Unfortunately I haven't found any video with ads before the fix. Maybe @antonok-edm has ideas on how to verify it properly.

I haven't seen any either, unfortunately.

@srirambv
Copy link
Contributor

srirambv commented Jun 22, 2020

Verification passed on Samsung Tab A with Android 9 running 1.10.95

  • Verified playing random videos on YT didn't show any ads (skippable and non-skippable)
  • Verified searching for videos and playing them doesn't show any ads
  • Verified visiting a publisher account and playing videos from their list doesn't show any ads

Verification passed on Samsung Galaxy Version 5.1.1 running BraveModernaarm.apk 1.10.95

  • Verified playing random videos on YT didn't show any ads (skippable and non-skippable)
  • Verified searching for videos and playing them doesn't show any ads
  • Verified visiting a publisher account and playing videos from their list doesn't show any ads

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

Successfully merging a pull request may close this issue.

5 participants