From b1014278d71e364ea0b4d0fd8cb99fff9cd6263d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Wr=C3=B3blewski?= Date: Mon, 24 Jun 2024 07:36:02 +0200 Subject: [PATCH] Upd youtube.com #178790 --- BaseFilter/sections/specific.txt | 3 +++ ExperimentalFilter/sections/English/specific_web_sites.txt | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/BaseFilter/sections/specific.txt b/BaseFilter/sections/specific.txt index 5a0ae50ab3e..0e490dfca1d 100644 --- a/BaseFilter/sections/specific.txt +++ b/BaseFilter/sections/specific.txt @@ -234,6 +234,9 @@ youtube.com#%#//scriptlet('trusted-replace-fetch-response', '"adSlots"', '"no_ad ! https://github.com/AdguardTeam/AdguardFilters/issues/172033#issuecomment-1925290685 ||googlevideo.com/initplayback?source=youtube&*&c=TVHTML5&oad=$xmlhttprequest,domain=youtube.com [$path=/tv]youtube.com#%#//scriptlet('json-prune', 'playerResponse.adPlacements playerResponse.playerAds playerResponse.adSlots adPlacements playerAds adSlots', '', '/https:\/\/www\.youtube\.com\/s\/player\/.*\/tv-player-ias\.vflset\/tv-player-ias\.js:/') +! Fix SSAP ads +www.youtube.com#%#//scriptlet('adjust-setTimeout', '[native code]', '17000', '0.001') +www.youtube.com#%#(()=>{let t=document.location.href,e=[],n=[],o="",i=!1;const r=Array.prototype.push,a={apply:(t,o,a)=>(window.yt?.config_?.EXPERIMENT_FLAGS?.html5_enable_ssap_entity_id&&a[0]&&a[0]!==window&&"number"==typeof a[0].start&&a[0].end&&"ssap"===a[0].namespace&&a[0].id&&(i||0!==a[0]?.start||n.includes(a[0].id)||(e.length=0,n.length=0,i=!0,r.call(e,a[0]),r.call(n,a[0].id)),i&&0!==a[0]?.start&&!n.includes(a[0].id)&&(r.call(e,a[0]),r.call(n,a[0].id))),Reflect.apply(t,o,a))};window.Array.prototype.push=new Proxy(window.Array.prototype.push,a),AG_onLoad((function(){if(!window.yt?.config_?.EXPERIMENT_FLAGS?.html5_enable_ssap_entity_id)return;const r=()=>{const t=document.querySelector("video");if(t&&e.length){const r=Math.round(t.duration),a=Math.round(e.at(-1).end/1e3),l=n.join(",");if(r&&r===a&&o!==l){const r=e.at(-1).start/1e3;t.currentTime{t!==document.location.href?(t=document.location.href,e.length=0,n.length=0,i=!1,r()):r()})).observe(document,{childList:!0,subtree:!0})}))})(); ! Fix ads on https://www.youtube.com/shorts/ ! https://github.com/AdguardTeam/AdguardFilters/issues/172033#issuecomment-1991263854 ! TODO: use scriptlet when this issue will be fixed - https://github.com/AdguardTeam/Scriptlets/issues/183 diff --git a/ExperimentalFilter/sections/English/specific_web_sites.txt b/ExperimentalFilter/sections/English/specific_web_sites.txt index 3b0c69c6eff..f004a9e2e6d 100644 --- a/ExperimentalFilter/sections/English/specific_web_sites.txt +++ b/ExperimentalFilter/sections/English/specific_web_sites.txt @@ -2,10 +2,6 @@ ! Rules that are restricted to one or more domains. ! This section contain any type of rule grouped by domain. ! -! Fix for new ads -! TODO: move to the Base filter if it doesn't break anything -www.youtube.com#%#//scriptlet('adjust-setTimeout', '[native code]', '17000', '0.001') -www.youtube.com#%#(()=>{let t=document.location.href,e=[],n=[],o="",i=!1;const r=Array.prototype.push,a={apply:(t,o,a)=>(window.yt?.config_?.EXPERIMENT_FLAGS?.html5_enable_ssap_entity_id&&a[0]&&a[0]!==window&&"number"==typeof a[0].start&&a[0].end&&"ssap"===a[0].namespace&&a[0].id&&(i||0!==a[0]?.start||n.includes(a[0].id)||(e.length=0,n.length=0,i=!0,r.call(e,a[0]),r.call(n,a[0].id)),i&&0!==a[0]?.start&&!n.includes(a[0].id)&&(r.call(e,a[0]),r.call(n,a[0].id))),Reflect.apply(t,o,a))};window.Array.prototype.push=new Proxy(window.Array.prototype.push,a),AG_onLoad((function(){if(!window.yt?.config_?.EXPERIMENT_FLAGS?.html5_enable_ssap_entity_id)return;const r=()=>{const t=document.querySelector("video");if(t&&e.length){const r=Math.round(t.duration),a=Math.round(e.at(-1).end/1e3),l=n.join(",");if(r&&r===a&&o!==l){const r=e.at(-1).start/1e3;t.currentTime{t!==document.location.href?(t=document.location.href,e.length=0,n.length=0,i=!1,r()):r()})).observe(document,{childList:!0,subtree:!0})}))})(); ! remove anti-adb ! !#if (!adguard_ext_firefox) ! www.youtube.com#%#(()=>{const wrapper=(target,thisArg,args)=>{let result=Reflect.apply(target,thisArg,args);try{const decoded=atob(result);if(decoded.includes('bkaEnforcementMessage')){const modifiedContent=decoded.replace(/\n.\n.auxiliaryUi\.messageRenderers\.bkaEnforcementMessageViewModel\.displayType.\dENFORCEMENT_MESSAGE_VIEW_MODEL_DISPLAY_TYPE_[A-Z]+\n.\n.auxiliaryUi\.messageRenderers\.bkaEnforcementMessageViewModel\.isVisible.{2}(?:tru|fals)e/,'');const encodeToBase64=btoa(modifiedContent);return encodeToBase64}}catch(e){} return result};const handler={apply:wrapper};window.Array.prototype.join=new Proxy(window.Array.prototype.join,handler)})();