uBlockOrigin / uAssets

Resources for uBlock Origin, uMatrix: static filter lists, ready-to-use rulesets, etc.
GNU General Public License v3.0
4.14k stars 774 forks source link

New "Sign In" request on YouTube #7842

Closed Yaron10 closed 4 years ago

Yaron10 commented 4 years ago

URL(s) where the issue occurs

https://www.youtube.com/watch?v=dHrd54S_FYQ

Describe the issue

A new "Sign In" request appears on many YouTube videos if you're not signed in.

### Screenshot(s) ![תמונה](https://user-images.githubusercontent.com/10229320/91622121-5649c080-e99e-11ea-8c88-7fdf11c7dbe9.png)

Versions

krystian3w commented 4 years ago

@yourduskquibbles / @randomcookiemonster

https://github.com/yourduskquibbles/webannoyances/issues/245#issuecomment-682655559

Here's a screenshot, though I probably shouldn't have cropped it: https://imgur.com/a/4Q6B158

Yaron10 commented 4 years ago

@krystian3w,

Thank you.

krystian3w commented 4 years ago

I hope it does not require reaching for it: nanop-click-elements-onready.js

Yaron10 commented 4 years ago

@uBlock-user,

It appears intermittently. Allow cookies for YouTube and close/restart Firefox a few times.

Thank you.

krystian3w commented 4 years ago

https://en.wikipedia.org/wiki/A/B_testing - if Google wants to, it will not see it until it reaches all users.

krystian3w commented 4 years ago

Reddit issue: https://old.reddit.com/r/uBlockOrigin/comments/ikgz0v/youtube_annoyance/

yourduskquibbles commented 4 years ago

I think the signin popup script code is being loaded through https://www.youtube.com/s/desktop/5068772e/jsbin/desktop_polymer_inlined_html_polymer_flags.vflset/desktop_polymer_inlined_html_polymer_flags.js

You can use ctrl + f and search for Polymer({is:"ytd-consent-bump-renderer" to find in the source but I don't know enough js/script defusers to know if it is able to be defused though?

minified code section (click to expand) ```javascript Polymer({is:"ytd-consent-bump-renderer",behaviors:[V.YtRendererBehavior,T.YtActionSenderBehavior,X.YtActionHandlerBehavior],screenLayer:4,properties:{data:{type:Object,observer:"maybeForceConsent_"}},actionMap:{"yt-close-popup-action":"handlePopupClose_"},handlePopupClose_:function(a){this.signinPromptClosed_||"yt-upsell-dialog-renderer"!==a||(this.signinPromptClosed_=!0,this.maybeForceConsent_(this.data))}, created:function(){this.expressVe_=this.acceptVe_=this.lightbox_=null;this.signinPromptClosed_=!0;z("kevlar_sign_in_prompt_before_mandatory_consent")&&(this.signinPromptClosed_=!1);this.disableConsentBump_=z("mandatory_consent_bump")&&!qia()}, ready:function(){var a=this;this.disableConsentBump_||z("kevlar_sign_in_prompt_before_mandatory_consent")&&uk(xk,function(){a.forceShowIfNoBlockingSigninPrompt()},5E3)}, attached:function(){this.disableConsentBump_?this.hideConsentBump_():(this.listen(window,"message","onReceivedMessage_"),this.lightbox_&&this.fire("yt-add-element-to-app",this.lightbox_))}, detached:function(){this.disableConsentBump_||this.unlisten(window,"message","onReceivedMessage_")}, maybeForceConsent_:function(a){this.disableConsentBump_||(a&&this.async(function(){this.fire("yt-consent-bump-display-changed")}),this.initializeVE_(),a&&a.forceConsent?(this.hideConsentBump_(),this.signinPromptClosed_&&(this.async(this.pausePlayer_.bind(this),1E3),this.openLightbox_())):"true"==pl("HideTicker","false")&&this.hideConsentBump_())}, initializeVE_:function(){var a=LN();MN(a,106531,void 0,{layer:4,parentLayer:0});this.acceptVe_=RN(a,{veType:104841},void 0,4);this.expressVe_=RN(a,{veType:105964},void 0,4)}, createLightbox_:function(){var a=document.createElement("ytd-consent-bump-lightbox");a.id="consent-bump";document.body.appendChild(a);this.data&&this.data.forceConsent?(a.getDialog().modal=!0,z("mandatory_consent_bump")&&(a.getDialog().style.maxHeight="550px")):a.getDialog().withBackdrop=!0;this.fire("yt-add-element-to-app",a);return a}, getConsentBumpIcon_:function(a){return a.toLowerCase()}, onReceivedMessage_:function(a){if(!this.lightbox_){var b=this.getLightbox_();if(b)this.lightbox_=b;else return}b=Md(a.origin);if(WLa[b]&&WLa.hasOwnProperty(b)||Gd("consent_url_override"))switch((b=kn(this.getScreenLayer()))&&("cb-ui-done-early"===a.data&&this.acceptVe_?$K(b,this.acceptVe_):"cb-express-done"===a.data&&this.expressVe_&&$K(b,this.expressVe_)),a.data){case"cb-ui-done-early":case"cb-ui-done":case"cb-express-done":case"cb-already-consented":this.hideConsentBump_();case"cb-user-closed":this.lightbox_.getDialog().close(); this.resumePlayer_();break;case"verify-origin":a.source.parent==window&&a.source.postMessage("verify-origin-reply",a.origin);}}, onRemindMeLaterTap_:function(){ol("HideTicker","true",86400);this.hideConsentBump_()}, onReviewTap_:function(){this.pausePlayer_();this.openLightbox_()}, openLightbox_:function(){var a=kn(this.getScreenLayer());a&&(this.acceptVe_&&YK(a,[this.acceptVe_]),this.expressVe_&&z("mandatory_consent_bump")&&YK(a,[this.expressVe_]));(a=this.getLightbox_())||(a=this.createLightbox_());a.getIframe().src=this.data.iframeUrl;this.lightbox_=a;a.getDialog().open()}, pausePlayer_:function(){var a=WO(this);a&&a.pause()}, hideConsentBump_:function(){this.hidden=!0;this.fire("yt-consent-bump-display-changed")}, resumePlayer_:function(){var a=WO(this);a&&a.play()}, getLightbox_:function(){var a=document.querySelector("ytd-app")||document.querySelector("ytg-app");return a?a.querySelector("#consent-bump"):null}, forceShowIfNoBlockingSigninPrompt:function(){var a=this.sendAction("yt-get-popup-opened-action",["yt-upsell-dialog-renderer"]);0!==a.length&&a[0]||this.handlePopupClose_("yt-upsell-dialog-renderer")},get _template(){if(!this.__$tmpl){this.__$tmpl=document.createElement("template");this.__$tmpl.innerHTML="\n \n \n \n \n \n \n \n \n \n \n "}return this.__$tmpl},set _template(v){this.__$tmpl=v}}); ```
unminified readable format (click to expand) ```javascript Polymer({ is: "ytd-consent-bump-renderer", behaviors: [V.YtRendererBehavior, T.YtActionSenderBehavior, X.YtActionHandlerBehavior], screenLayer: 4, properties: { data: { type: Object, observer: "maybeForceConsent_" } }, actionMap: { "yt-close-popup-action": "handlePopupClose_" }, handlePopupClose_: function (a) { this.signinPromptClosed_ || "yt-upsell-dialog-renderer" !== a || (this.signinPromptClosed_ = !0, this.maybeForceConsent_(this.data)) }, created: function () { this.expressVe_ = this.acceptVe_ = this.lightbox_ = null; this.signinPromptClosed_ = !0; z("kevlar_sign_in_prompt_before_mandatory_consent") && (this.signinPromptClosed_ = !1); this.disableConsentBump_ = z("mandatory_consent_bump") && !qia() }, ready: function () { var a = this; this.disableConsentBump_ || z("kevlar_sign_in_prompt_before_mandatory_consent") && uk(xk, function () { a.forceShowIfNoBlockingSigninPrompt() }, 5E3) }, attached: function () { this.disableConsentBump_ ? this.hideConsentBump_() : (this.listen(window, "message", "onReceivedMessage_"), this.lightbox_ && this.fire("yt-add-element-to-app", this.lightbox_)) }, detached: function () { this.disableConsentBump_ || this.unlisten(window, "message", "onReceivedMessage_") }, maybeForceConsent_: function (a) { this.disableConsentBump_ || (a && this.async(function () { this.fire("yt-consent-bump-display-changed") }), this.initializeVE_(), a && a.forceConsent ? (this.hideConsentBump_(), this.signinPromptClosed_ && (this.async(this.pausePlayer_.bind(this), 1E3), this.openLightbox_())) : "true" == pl("HideTicker", "false") && this.hideConsentBump_()) }, initializeVE_: function () { var a = LN(); MN(a, 106531, void 0, { layer: 4, parentLayer: 0 }); this.acceptVe_ = RN(a, { veType: 104841 }, void 0, 4); this.expressVe_ = RN(a, { veType: 105964 }, void 0, 4) }, createLightbox_: function () { var a = document.createElement("ytd-consent-bump-lightbox"); a.id = "consent-bump"; document.body.appendChild(a); this.data && this.data.forceConsent ? (a.getDialog().modal = !0, z("mandatory_consent_bump") && (a.getDialog().style.maxHeight = "550px")) : a.getDialog().withBackdrop = !0; this.fire("yt-add-element-to-app", a); return a }, getConsentBumpIcon_: function (a) { return a.toLowerCase() }, onReceivedMessage_: function (a) { if (!this.lightbox_) { var b = this.getLightbox_(); if (b) this.lightbox_ = b; else return } b = Md(a.origin); if (WLa[b] && WLa.hasOwnProperty(b) || Gd("consent_url_override")) switch ((b = kn(this.getScreenLayer())) && ("cb-ui-done-early" === a.data && this.acceptVe_ ? $K(b, this.acceptVe_) : "cb-express-done" === a.data && this.expressVe_ && $K(b, this.expressVe_)), a.data) { case "cb-ui-done-early": case "cb-ui-done": case "cb-express-done": case "cb-already-consented": this.hideConsentBump_(); case "cb-user-closed": this.lightbox_.getDialog().close(); this.resumePlayer_(); break; case "verify-origin": a.source.parent == window && a.source.postMessage("verify-origin-reply", a.origin); } }, onRemindMeLaterTap_: function () { ol("HideTicker", "true", 86400); this.hideConsentBump_() }, onReviewTap_: function () { this.pausePlayer_(); this.openLightbox_() }, openLightbox_: function () { var a = kn(this.getScreenLayer()); a && (this.acceptVe_ && YK(a, [this.acceptVe_]), this.expressVe_ && z("mandatory_consent_bump") && YK(a, [this.expressVe_])); (a = this.getLightbox_()) || (a = this.createLightbox_()); a.getIframe().src = this.data.iframeUrl; this.lightbox_ = a; a.getDialog().open() }, pausePlayer_: function () { var a = WO(this); a && a.pause() }, hideConsentBump_: function () { this.hidden = !0; this.fire("yt-consent-bump-display-changed") }, resumePlayer_: function () { var a = WO(this); a && a.play() }, getLightbox_: function () { var a = document.querySelector("ytd-app") || document.querySelector("ytg-app"); return a ? a.querySelector("#consent-bump") : null }, forceShowIfNoBlockingSigninPrompt: function () { var a = this.sendAction("yt-get-popup-opened-action", ["yt-upsell-dialog-renderer"]); 0 !== a.length && a[0] || this.handlePopupClose_("yt-upsell-dialog-renderer") }, get _template() { if (!this.__$tmpl) { this.__$tmpl = document.createElement("template"); this.__$tmpl.innerHTML = "\n \n \n \n \n \n \n \n \n \n \n " } return this.__$tmpl }, set _template(v) { this.__$tmpl = v } }); ```

x-posted from https://github.com/yourduskquibbles/webannoyances/issues/245#issuecomment-685989183

krystian3w commented 4 years ago

@Yaron10 try this: https://github.com/uBlockOrigin/uAssets/issues/7636#issuecomment-687200509

youtube.com##+js(set, yt_logging_screen, undefined)
Yaron10 commented 4 years ago

@krystian3w,

Thank you.

The prompt appears intermittently. Now it's NOT showing. :) I'll try again and report back.

Yaron10 commented 4 years ago

@krystian3w,

Sadly it does not work.

ghajini commented 4 years ago

Simply click Not now (from 1st party YT), why filters for that? If anyone wants to sign in for watching and if you add filters for that, they will not see this prompt (which is 1st party)

krystian3w commented 4 years ago

Many people too fast clear cookies (e.g. on close YT tabs / browser windows), so that pop-up and/or overlay above player is visible too many as YouTube recommend.

pixeltris commented 4 years ago

Not sure if this is exactly the same thing but I've recently seen two prompts.

1) A prompt with text "Sign in to YouTube" with the options "NO THANKS" / "SIGN IN". 2) A consent form similar to Google's "Before you continue".

They appear to both be controlled by desktop_polymer_inlined_html_polymer_flags.js. From what I can tell the main html page states if "Sign in" should be used via the settings "kevlar_sign_in_prompt_before_mandatory_consent":true and kevlar_sign_in_prompt_before_mandatory_consent=true. That setting is listed under serializedExperimentFlags (might eventually be fully adapted to all users, maybe not). The consent form is called via maybeForceConsent_. I'm not 100% sure on path of execution that hits that point though.

I wasn't able to create a filter that worked nicely as any visual filter still results in a paused video. I managed to get the consent form to go away with a Fiddler script, I think the "Sign in" prompt would also go away with this edit but I'm no longer being served it so I cannot test.

Maybe this code could be brought forward to uBlock if edits like this are possible?

https://gist.githubusercontent.com/pixeltris/1e32c2381fc45a6c217fb606fc87da2b/raw/510cebe42fd54d032d518f891990707c939a825c/Yt.cs

It should also be noted that you will be served the same "CONSENT" cookie, even after clearing your cookies. Some very nasty tracking going on there?

krystian3w commented 4 years ago

How this works with browser (e.g. Chrome / Firefox) by .NET framework? No better convert this into .user.js and publish on greasyfork as long no possible convert to e.g. set-constant / abort-on-property-read?

gwarser commented 4 years ago

Maybe it will be easier to completely "broke" these experiments?

krystian3w commented 4 years ago

By watch only vimeo / dailymotion / twitch or on only embedded versions of videos?

gwarser commented 4 years ago

By scriptlets.

I have problems even reading YT source on my PC, it's so large :(

pixeltris commented 4 years ago

For the "Sign in to YouTube" dialog this userResourcesLocation script might work (annoyingly I can't get userResourcesLocation to work for me for some reason...)

https://gist.githubusercontent.com/pixeltris/b79707fa8a704e0058c7f1af83d5935a/raw/0e309debbb2ef962b43358453871fe38cc36a3e8/Yt.js

krystian3w commented 4 years ago

Bad url, use this: https://gist.githubusercontent.com/pixeltris/b79707fa8a704e0058c7f1af83d5935a/raw/Yt.js

# Hide "Sign in to YouTube" dialog
youtube-dialog.js application/javascript
(function() {
    var domReady = function(ev) {
        if ( ev ) {
            document.removeEventListener(ev.type, domReady);
        }
        if (window["ytInitialPlayerResponse"]?.auxiliaryUi?.messageRenderers?.upsellDialogRenderer != null) {
            window["ytInitialPlayerResponse"].auxiliaryUi.messageRenderers.upsellDialogRenderer.isVisible = false;
        }
    };
    if ( document.readyState === 'loading' ) {
        document.addEventListener('DOMContentLoaded', domReady);
    } else {
        domReady();
    }
})();
pixeltris commented 4 years ago

There shouldn't be much difference in those two urls right? One picks up the master and one is a specific revision? Either way I can't get any to work, I can't even get a simple console.log to work :(

uBlock-user commented 4 years ago

@pixeltris youtube.com##+js(set, ytInitialPlayerResponse.auxiliaryUi.messageRenderers.upsellDialogRenderer.isVisible, false)

Why not just use set instead as you're trying to set a value after all ?

krystian3w commented 4 years ago

Why not just use

Beacause AdGuard also like:

! pussyspace.com,pussyspace.net - ads from ExoLoader on extensions
pussyspace.com,pussyspace.net#%#AG_defineProperty('exoDocumentProtocol', { value: window.document.location.protocol });
krystian3w commented 4 years ago

There shouldn't be much difference in those two urls right?

Your no show new commits added on your secret gist, so can down fast if need many updates.

pixeltris commented 4 years ago

@uBlock-user ah that seems to work, thanks.

Might still need a script though. There's another "consent" popup (similar to google's consent popup). Setting a cookie similar to CONSENT=YES+GB.en seems to resolve this. Maybe there's another workaround, I'll poke around some more.

krystian3w commented 4 years ago

AdGuard bake "CONSENT=YES+GB.en":

google.*,youtube.com#%#(function(){try{var b=(new Date).getTime(),c=new Date(b+1314E6),a=location.host;a.startsWith("google.")||a.startsWith("youtube.")||(locSubString=a.substring(a.indexOf(".")+1));loc=locSubString||a;document.cookie="CONSENT=YES+; domain="+loc+"; path=/; expires="+c.toUTCString()}catch(d){}})();
(function() {
    try {
        var b = (new Date).getTime(),
            c = new Date(b + 1314E6),
            a = location.host;
        a.startsWith("google.") || a.startsWith("youtube.") || (locSubString = a.substring(a.indexOf(".") + 1));
        loc = locSubString || a;
        document.cookie = "CONSENT=YES+; domain=" + loc + "; path=/; expires=" + c.toUTCString()
    } catch (d) {}
})();

Also no recommend clicker into button as safe for Google/YouTube (but click "accept" on many other pages).

pixeltris commented 4 years ago

The following seems to work to disable the consent popup (may not work on non-desktop platforms i.e. "desktopTopbarRenderer"). There are a few other code paths which can trigger that consent popup, but there are similar settings that can be toggled to stop them (but I haven't hit those code paths to confirm they are correct).

youtube.com##+js(set, ytInitialData.topbar.desktopTopbarRenderer.interstitial.consentBumpRenderer.forceConsent, false)

Does anyone know of a country/IP which would trigger the "Get the best YouTube experience" thing?

krystian3w commented 4 years ago

@yourduskquibbles / @randomcookiemonster / @Yaron10 test:

https://github.com/uBlockOrigin/uAssets/issues/7842#issuecomment-694311598 + https://github.com/uBlockOrigin/uAssets/issues/7842#issuecomment-694394240


@THEtomaso - you have "Get the Best experience" overlay (?) - not pop-up with Key hole~!

If you have, so try:

youtube.com##+js(set-constant.js, ytInitialPlayerResponse.auxiliaryUi.messageRenderers.upsellDialogRenderer.isVisible, false)
youtube.com##+js(set-constant.js, ytInitialData.topbar.desktopTopbarRenderer.interstitial.consentBumpRenderer.forceConsent, false)

on Pale Moon / ungoogled-chromium.

⚠️ no longer safe ⚠️ - these break load homepage.

pixeltris commented 4 years ago

I imagine "Get the best YouTube experience" will be it's own separate thing, but it might be another thing listed under messageRenderers.

pixeltris commented 4 years ago

How does youtube.com##+js work exactly? When clicking videos I think youtube loads the pages without actually redirecting? Therefore when the new page loads I don't think it triggers the youtube.com##+js thing again? Resulting in the consent popup.

THEtomaso commented 4 years ago

you have "Get the Best experience" overlay (?)

No.

uBlock-user commented 4 years ago

When clicking videos I think youtube loads the pages without actually redirecting?

Videos are pulled by AJAX fetch requests on YT, so the scriptlet is not inserted as the root document request is not fired. uBO inserts the scriptlet at the very earliest when a document request is fired.

THEtomaso commented 4 years ago

The issue with stopping videos finally seems to have been solved in AdGuard Annoyances filter now!! :tada:

krystian3w commented 4 years ago

Nope, disabled:

youtube.com##+js(set-constant.js, ytInitialPlayerResponse.auxiliaryUi.messageRenderers.upsellDialogRenderer.isVisible, false)

In about an hour or so, you will see this after updating the list.

https://github.com/AdguardTeam/AdguardFilters/commit/72f49b2faab17307812c7047c1446adb950bacc2 - shame:

THEtomaso commented 4 years ago

I've got no idea as to what you're talking about, krystian3w.

These rules definitely fixes the problem at my end (uBO Legacy editions)!:

youtube.com##+js(set-constant.js, ytInitialPlayerResponse.auxiliaryUi.messageRenderers.upsellDialogRenderer.isVisible, false)

youtube.com##+js(set-constant.js, ytInitialData.topbar.desktopTopbarRenderer.interstitial.consentBumpRenderer.forceConsent, false)

They're your rules, right?

uBlock-user commented 4 years ago

@THEtomaso Do you need both ?

krystian3w commented 4 years ago

AdGuard sitll no fixed very old bug "https://github.com/uBlockOrigin/uBlock-issues/issues/156", how long no repair - how long you need manually copy:

youtube.com##+js(set-constant.js, ytInitialPlayerResponse.auxiliaryUi.messageRenderers.upsellDialogRenderer.isVisible, false)

becasue this commit disable filter in AG Annoyance: https://github.com/AdguardTeam/AdguardFilters/commit/72f49b2faab17307812c7047c1446adb950bacc2

THEtomaso commented 4 years ago

Do you need both ?

Actually, they only seem to solve the issue, when combined with other rule(s), found in uBO Filters, or elsewhere. It requires further testing, to derminine what exactly.

--

EDIT: There are a shitload of rules being applied, at my end. It will be very difficult to find the "magic" combination.

krystian3w commented 4 years ago

Who added:

youtube.com##+js(set-constant.js, ytInitialData.topbar.desktopTopbarRenderer.interstitial.consentBumpRenderer.forceConsent, false)

into uBO filters?

this block GDPR:

7921

7877

7878

THEtomaso commented 4 years ago

The former of the two rules has been removed now, and simply restoring it under "My filters" doesn't do the trick. Any idea what else was removed?? I'm sure I had a working combo there, for a while!!

pixeltris commented 4 years ago

So to clarify:

"Sign in to YouTube" dialog is controlled via ytInitialPlayerResponse.auxiliaryUi.messageRenderers.upsellDialogRenderer.isVisible. I think the reason why it was briefly added then removed from Adguard Annoyances is because not everyone is served that path, which means when setting just isVisible it possibly created a corrupted state and stops videos from loading? https://github.com/AdguardTeam/AdguardFilters/issues/63741#issuecomment-694934874 maybe setting upsellDialogRenderer to null might be an alternative? Not 100% sure.

The consent dialog is controlled via ytInitialData.topbar.desktopTopbarRenderer.interstitial.consentBumpRenderer.forceConsent. The problem with this one is that when navigating to other videos forceConsent value is wiped over, so you will see the popup at that point. Setting a cookie CONSENT=YES+ is also another alternative to stopping this dialog.

peace2000 commented 4 years ago

Hiding this Sign in request prevents using the search on Youtube.

tedomedo commented 4 years ago

Using www.youtube.com##.opened is ok, except that video is always paused so that we have to click triangle to start playback and that we can't use search - i don't ca about that, we can use google search for youtube search. About google: have you fund 100% working filters for "before you continue"?

krystian3w commented 4 years ago

How reproduce broken search bar?

peace2000 commented 4 years ago

My bad, it's ok now.