x0a / uBO-YouTube

Easier way to exempt your favorite YouTube channels from adblocking.
GNU General Public License v3.0
124 stars 8 forks source link

I'm not seeing any ads #24

Closed Gaarco closed 3 years ago

Gaarco commented 3 years ago

I added the *youtube.com/*&disableadblock=1 string as specified and whitelisted all my subscriptions, but I don't see ads. I'm using Firefox and uBlock Origin

Jw-Tan commented 3 years ago

Ads only appear on my whitelisted channels after I refresh the video. So, the first time the video loads, the &disableadblock=1 is appended, and only by refreshing the page then I'll get ads. If this is the intended behaviour, then it's not particularly useful for me honestly. I'm on Vivaldi using the chrome extension.

I used to use a Tampermonkey script for whitelisting channels (it adds an unique channel string instead of a generic one) which seems to be broken recently and switched to this. In that old script, the same process happens, but the appending of the string happens together with a page refresh. Personally, I don't mind if this behaviour is adopted for this extension.

x0a commented 3 years ago

Thanks for the report

@Gaarco When you whitelist a channel, or visit a video with a whitelisted channel, can you confirm that the uBO icon greys out? E.g. example



but the appending of the string happens together with a page refresh. Personally, I don't mind if this behaviour is adopted for this extension.

To clarify, you mean automatically refresh the page as soon as whitelist status can be determined (channel ID is detected)? I did in a prior version (see issue https://github.com/x0a/uBO-YouTube/issues/15). Ultimately I removed the behavior because it was rather unpopular. However I can re-implement that behavior as an optional feature. Should be rather easy to implement. Let me know if this is what you're after.

As to whether the behavior is intentional, it kind of is and isn't. If you load any part of YouTube, it takes a second or so for channel metadata to load, so the information necessary to determine whether ads should be shown takes around 600-1500ms. Ad-related metadata often loads before channel metadata (in fact, it almost always does). But from that point on, any videos in the related section, search page, homepage or playlists should automatically have the &disableadblock=1 flag prepended if they are whitelisted, because currently YouTube loads channel metadata along with the clickable video/channel. This extension takes advantage of that. But on the initial video load, we err on the side of blocking ads until whitelist status can be determined. This involves removing ad metadata loaded via JSON, which effectively removes ads for the remainder of the video. Long story short, ads not being shown on initial video load is currently intentional, but ads should be shown on whitelisted channels if you continue to browse from that page. If you continue to browse in that same page, and ads are not showing on videos from whitelisted channels, that's a bug.

Because we have other built-in ways to remove ads, I suppose on initial video load we could disable JSON-prune adblocking and leave every other adblocking method enabled until enough information is available to determine otherwise. I'll experiment with this and will try to have an update within the week.

Let me know

And again, thank you both

Jw-Tan commented 3 years ago

Hi x0a. Although your first point wasn't addressed to me, yes, I can confirm that ublock is disabled and greyed out on the whitelisted page.

But from that point on, any videos in the related section, search page, homepage or playlists should automatically have the &disableadblock=1 flag prepended if they are whitelisted

on the initial video load, we err on the side of blocking ads until whitelist status can be determined. This involves removing ad metadata loaded via JSON

ads should be shown on whitelisted channels if you continue to browse from that page. If you continue to browse in that same page, and ads are not showing on videos from whitelisted channels, that's a bug

So that's the reason! I use Feedly to know when new videos are uploaded to my subscribed channels, I used email notifications prior to this until Youtube removed it. The way I view Youtube content is clicking the link from Feedly/email notifications, which opens a new tab to load the video, so it won't have the metadata yet. After that's done, I would go back to Feedly and follow the next video. I very rarely navigate to another video inside the same page (such as clicking on a related video). Even if I do so, it is usually to a non-subbed channel which I don't whitelist, since I would have already watched related ones from the same channel already.

The script I used to use was this. If I open a say, LinusTechTips video, 1) the tab will start to load with the normal URL with ublock enabled, 2) does a refresh automatically within the first couple of seconds, 3) and then the URL will be appended with &user=LinusTechTips and ads will show up . Of course this means I would have to add a rule per channel into my trusted sites list. I can see why not everyone is on board with this solution but I was happy with it. I wasn't aware this used to be implemented here but I would appreciate it as an optional feature.

Not sure what happened to Youtube that caused that script to fail but recently, after the channel ID is added, it refreshes again removing the ID, and now that it does not detect any ID, it refreshes once more to add it, and it just keeps refreshing forever.

Thank you.

x0a commented 3 years ago

So that's the reason! I use Feedly to know when new videos are uploaded to my subscribed channels, I used email notifications prior to this until Youtube removed it. The way I view Youtube content is clicking the link from Feedly/email notifications, which opens a new tab to load the video, so it won't have the metadata yet. After that's done, I would go back to Feedly and follow the next video. I very rarely navigate to another video inside the same page (such as clicking on a related video). Even if I do so, it is usually to a non-subbed channel which I don't whitelist, since I would have already watched related ones from the same channel already.

That makes perfect sense. If you are always clicking on videos from external sources then they will always load without ads on initial page views and since you've already (likely) viewed the related videos, there's no time to test the alternative. I think your use case is perfectly reasonable (I used Feedly for a time as well) and I'll try to implement an optional feature that takes this into account. It will involve going to uBO-YouTube > Options > Ads to enable the feature.

I'll try to implement this over my weekend (Sun & Mon) but could take until next week depending on my schedule. No response required.

Thank you for the update

Gaarco commented 3 years ago

@x0a I can confirm uBlock icon is greyed out when I'm watching a whitelisted channel and I'm opening the videos directly from youtube, not from other sources

x0a commented 3 years ago

@Gaarco I've been trying to reproduce the issue for the past few days and have been unable to (Firefox 86.0.1, Windows 10, macOS Big Sur, Ubuntu 20). It could be a region specific change by YouTube (for reference, I am in the US), an extra extension, or something else.

Could you press F12 on a whitelisted video and post a screenshot? It will look something like this on a whitelisted video Untitled



If you enable Requests it will show requests that were blocked by extensions. If you reload a whitelisted video, nothing should be blocked by extension. With the exception of blacklisted advertisers, this extension blocks ads by intercepting native XHR/DOM/fetch requests, so they will only be logged by the extension and not by the browser.

Here is an example of uBO blocking ads via network filters on a non-whitelisted page. If you see this, it could be an extension other than this causing the issue.

untitled2

I'd like to fix this before the next update. Let me know

Thanks

x0a commented 3 years ago

@Jw-Tan I've added a feature named Force whitelist on first load to version 0.13.4 which should now be live on Mozilla Addons (Chrome Web Store typically takes a few days). Please update your addons and enable the feature here. This is a new feature so bugs may exist. Let me know if you encounter any unexpected behavior.

Gaarco commented 3 years ago

@x0a this is the console log on a whitelisted video: Screenshot from 2021-03-16 08-50-28

I don't think my other extensions are the cause, I have Auto Tab Discard, Bitwarden, Distract Me Not, Panorama View, uBlock Origin, Video Speed Controller, Windscribe and yours

Gaarco commented 3 years ago

Just discovered Windscribe also blocks ads and it is not just a VPN client, that was the reason. I'm sorry for bothering you for nothing, I'm closing the issue. Thank you!

x0a commented 3 years ago

No worries, good to know!

Have a good one!