uBlockOrigin/uAssets

New "Sign In" request on YouTube

Closed this issue · 44 comments

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)

תמונה

Versions

  • Browser/version: [Firefox 79]
  • uBlock Origin version: [1.29.2]

@yourduskquibbles / @randomcookiemonster

yourduskquibbles/webannoyances#245 (comment)

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

@krystian3w,

Thank you.

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

@uBlock-user,

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

Thank you.

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

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)
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="<!--css-build:shady-->\n    \n    \n    <yt-icon id=\"consent-shield\" icon=\"yt-icons:[[getConsentBumpIcon_(data.securityIcon.iconType)]]\" class=\"style-scope ytd-consent-bump-renderer\">\n    </yt-icon>\n    <yt-formatted-string id=\"alert-message\" text=\"[[data.alertMessage]]\" class=\"style-scope ytd-consent-bump-renderer\">\n    </yt-formatted-string>\n    <ytd-button-renderer id=\"remind-me-later-button\" data=\"[[data.remindMeLaterButton.buttonRenderer]]\" on-tap=\"onRemindMeLaterTap_\" class=\"style-scope ytd-consent-bump-renderer\">\n    </ytd-button-renderer>\n    <ytd-button-renderer id=\"review-button\" data=\"[[data.reviewButton.buttonRenderer]]\" on-tap=\"onReviewTap_\" class=\"style-scope ytd-consent-bump-renderer\">\n    </ytd-button-renderer>\n  "}return this.__$tmpl},set _template(v){this.__$tmpl=v}});
unminified readable format (click to expand)
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 = "<!--css-build:shady-->\n    \n    \n    <yt-icon id=\"consent-shield\" icon=\"yt-icons:[[getConsentBumpIcon_(data.securityIcon.iconType)]]\" class=\"style-scope ytd-consent-bump-renderer\">\n    </yt-icon>\n    <yt-formatted-string id=\"alert-message\" text=\"[[data.alertMessage]]\" class=\"style-scope ytd-consent-bump-renderer\">\n    </yt-formatted-string>\n    <ytd-button-renderer id=\"remind-me-later-button\" data=\"[[data.remindMeLaterButton.buttonRenderer]]\" on-tap=\"onRemindMeLaterTap_\" class=\"style-scope ytd-consent-bump-renderer\">\n    </ytd-button-renderer>\n    <ytd-button-renderer id=\"review-button\" data=\"[[data.reviewButton.buttonRenderer]]\" on-tap=\"onReviewTap_\" class=\"style-scope ytd-consent-bump-renderer\">\n    </ytd-button-renderer>\n  "
        }
        return this.__$tmpl
    },
    set _template(v) {
        this.__$tmpl = v
    }
});

x-posted from yourduskquibbles/webannoyances#245 (comment)

@Yaron10 try this: #7636 (comment)

youtube.com##+js(set, yt_logging_screen, undefined)

@krystian3w,

Thank you.

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

@krystian3w,

Sadly it does not work.

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)

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.

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?

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?

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

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

By scriptlets.

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

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

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();
	}
})();

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 :(

@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 ?

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 });

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.

@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.

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).

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?

@yourduskquibbles / @randomcookiemonster / @Yaron10 test:

#7842 (comment) + #7842 (comment)


@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.

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

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.

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

No.

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.

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

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.

AdguardTeam/AdguardFilters@72f49b2 - shame:

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?

@THEtomaso Do you need both ?

AdGuard sitll no fixed very old bug "uBlockOrigin/uBlock-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: AdguardTeam/AdguardFilters@72f49b2

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.

Who added:

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

into uBO filters?

this block GDPR:

#7921
#7877
#7878

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!!

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? AdguardTeam/AdguardFilters#63741 (comment) 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.

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

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"?

How reproduce broken search bar?

  • For my is visible, possible write in this input,
  • list with sugestions is showed,
  • 🔍 / 🔎 is clickable,
  • works filters search list.

My bad, it's ok now.