yuliskov / SmartTube

SmartTube - an advanced player for set-top boxes and tvs running Android OS
https://www.patreon.com/smarttube
Other
19.77k stars 1.07k forks source link

How does ad blocking works in this app? #1916

Open saalmaan opened 2 years ago

saalmaan commented 2 years ago

Hello,

How does ad blocking works in this app? is it because there is web container with ublock support in this app or something else? Please direct me to any part in readme or existing thread that explain this part. I tried searching but did not get good results.

Cheers

toastyjc commented 2 years ago

I believe it loads the video file directly, thus bypassing the advertisements all together. There is no "ad blocking" in the app, so to speak.

When you use YouTube on the web, or via the YouTube app, it loads ads in addition to the video. My understanding is the app simply loads the video itself. Almost as if the ads don't exist.

ACR-Jeff commented 2 years ago

https://github.com/yuliskov/SmartTubeNext#adblocking

saalmaan commented 2 years ago

Thank you both @ACR-Jeff I read the Readme and this line in it specifically "It not just tries to prevent them, it is literally programmed to be completely unable to display any ads" my questions is how is it programmed to do that. i tried reading the code but I dont get how Java works as I am javascript person.

thank you @toastyjc These days youtube ads and actual video both load from the same URL, so how does this app finds video part of the URL from the ad part. I want to know the method behind just loading the videos.

@yuliskov would you mind shedding some light on this?

Many thanks

SodaWithoutSparkles commented 2 years ago

These days youtube ads and actual video both load from the same URL

its Domain not URL. A URL cannot point to two files.

I will try to understand the code and throw the relevant sections here...

saalmaan commented 2 years ago

@SodaWithoutSparkles Thank you for helping out

SodaWithoutSparkles commented 2 years ago

I think its just fetching the URL using the video ID directly. Normal YT fetches at least two URL, one for the video and the other for ads. Since the method to load ads just isnt there in the first place, you cannot possibly see ads.

saalmaan commented 2 years ago

Where is it fetching the video from using the video ID? is there a YT secret API? how does this app over come CORS? I am asking this because I want to develop node.js app for other platforms.

SodaWithoutSparkles commented 2 years ago

i guess its somewhere here or here

saalmaan commented 2 years ago

Javs is beyond me, I am going to ask one of my java guru friend to read this figure this out for me. its time we expand this open source to webOS and Tizen

maverick74 commented 1 year ago

Tizen would be great!!!

(it's a shame Samsung is betting less on it everyday when it should be betting more...)