-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Add a new scriptlet to intercept atob() call and prune its text output
Background: YT checks if anti-adblock warning (auxiliaryUi.messageRenderers.bkaEnforcementMessageViewModel
) is removed by blocker by checking playerResponse.responseContext.mainAppWebResponseContext.trackingParam
which includes encoded info about the warning if it is sent. If we remove this encoded info together with the warning, we can safely remove the warning. This is currently done with $replace
rules removing parts of trackingParam
but this approach is risky. The encoded info is finally decoded with atob
, and if we prune the info from the output of atob
, we can safely remove the info. If you want to check by yourself, search for 282054944_a
in /desktop_polymer.vflset
script in the debugger and put a break point before this, and follow the processing step by step. Here's the moment decoding was done when anti-adb is not sent. If sent, the output will be longer and include \n|\nGauxiliaryUi.messageRenderers.bkaEnforcementMessageViewModel.displayType\x121ENFORCEMENT_MESSAGE_VIEW_MODEL_DISPLAY_TYPE_POPUP\nM\nEauxiliaryUi.messageRenderers.bkaEnforcementMessageViewModel.isVisible\x12\x04true
.
Actual rules working on Chrome as of writing:
www.youtube.com#%#(()=>{const wrapper=(target,thisArg,args)=>{let result = Reflect.apply(target,thisArg,args);console.debug('Result atob:',result);if(result.includes('bkaEnforcementMessage')){const modifiedContent=result.replace('\n|\nGauxiliaryUi.messageRenderers.bkaEnforcementMessageViewModel.displayType\x121ENFORCEMENT_MESSAGE_VIEW_MODEL_DISPLAY_TYPE_POPUP\nM\nEauxiliaryUi.messageRenderers.bkaEnforcementMessageViewModel.isVisible\x12\x04true','');console.debug('Modified atob:',modifiedContent);return modifiedContent;}return result;};const handler={apply:wrapper};window.atob=new Proxy(window.atob,handler);})();
www.youtube.com#%#//scriptlet('set-constant', 'ytInitialPlayerResponse.auxiliaryUi.messageRenderers.bkaEnforcementMessageViewModel', 'undefined')
www.youtube.com#@%#//scriptlet('trusted-replace-fetch-response', '/("trackingParam":"kx_fmPxhoPZR)[-_0-9A-Za-z]{150}[-_0-9A-Za-z]+?([-_0-9A-Za-z]{55}lLKPQ-SS"\})/', '$1$2', 'player?')
www.youtube.com#@%#//scriptlet('trusted-replace-fetch-response', '/("trackingParam":"k5DfmPxhoXpR)[-_0-9A-Za-z]{150}[-_0-9A-Za-z]+?([-_0-9A-Za-z]{151}lLKPQGiS"\})/', '$1$2', 'player?')
www.youtube.com#%#//scriptlet('json-prune', 'playerResponse.adPlacements playerResponse.playerAds playerResponse.adSlots adPlacements playerAds adSlots')
The first line is what should be the new scriptlet. The next line overwrites auxiliaryUi.messageRenderers.bkaEnforcementMessageViewModel
on Chromium at the first load of yt video. The third and forth rules disable the current rules doing the same on raw trackingParam
, as we want to see the test rule works by itself. The last rule is to intentionally trigger the warning if the pruning failed.
May possibly be more generic scriptlet like trusted-prune-text-output
with target function as an argument (in this case atob
), 0-based position of tareget argument in the function, condition for the pruning to happen (e.g. input/output includes specified string or regex), and stack trace.