ghostery / adblocker

Efficient embeddable adblocker library

Home Page:https://www.ghostery.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Youtube TV (Leanback) ads not blocked

k2helix opened this issue · comments

As the title says, I'm trying to block https://youtube.com/tv (using a PS4 or smart TV user agent) following the README example but ads still show up in any video or even when browsing. This does not happen in youtube default website so I don't know how to proceed and am looking for some advice. Thanks in advance.

Hey @k2helix,

Thanks for reaching out! Could you provide more details on how to reproduce the issue? Ideally with a minimum repro script which I can run to investigate. Are you using Puppeteer, Electron, Playwright or browser blocker?

Hi, thanks for your response. You can see a whole electron app using it here: https://github.com/k2helix/YouTubeTV/blob/main/renderers/main/main.renderer.ts#L67 (its my fork of an app into which I tried to add adblock). Hope this is what you were asking for. Thanks again!

Hi @k2helix,

There was a recent update in resources used by the adblocker to block ads on YouTube. Would you be able to check again if this brought an improvement on your end?

Hi, I did it when it was released some days ago and also tried injecting the blocker earlier in the code but nothing worked. Note that sometimes (like 1 out of 5 times) when opening the app video ads don't get shown but they usually do so I try reopening it a few more times until I give up.

I did see some exception when trying it out locally, maybe some issue with latest resources. Cc @chrmod

image

I see. Please let me know if there is anything I can do or you need me to do

I did see some exception when trying it out locally, maybe some issue with latest resources. Cc @chrmod

image

Additional information: Running YouTube Music with the @cliqz/adblocker enabled causes this error and disables the preload script.

image

th-ch/youtube-music#1267

@JellyBrick @k2helix We've got a fix prepared here and locally I could get YouTube working again in Electron: #3501

Hi again and thanks for working on a fix! I've been trying it on the project I mentioned above and it blocks ads. However, it seems that when playing a video, there's a black screen for ~20 secs which I think that means Youtube thinks it's showing ads.
Basically it's blocking ads but the video is not played until the time for the ads that were assigned ends (or that's what I believe).

Here's a video where you can see its behaviour:
https://github.com/ghostery/adblocker/assets/49949593/a7b1415d-1865-4b5e-a1a9-91aca96a5f8e

@k2helix It seems like YouTube is pushing changes recently to circumvent blocking. I've checked with the latest assets just now and I cannot reproduce the issue anymore. Is it still happening to you?

@remusao It seems to be working fine now. Ironical that Youtube makes changes to avoid blockers in the main website and it makes blockers work in the TV site. Thanks for your help!

I have been using it for a bit and now when I opened the app and played a video the same thing (a black screen) happened.

Things are moving quickly and rules are updated every day. I've just merged the latest update. Hopefully that improves things but I think we should expect more instability with youtube.com in the coming days unfortunately.