Update #203236 youtube.com

This commit is contained in:
Adam Wróblewski
2025-08-11 13:42:23 +02:00
parent 6f73d0a9cb
commit aac18d2cd0

View File

@@ -2,9 +2,11 @@
! Rules that are restricted to one or more domains.
! This section contain any type of rule grouped by domain.
!
! TODO: If there will not be any issues with this rule, replace similar rule in Base filter with this rule
www.youtube.com#%#(()=>{const t={construct:(t,e,c)=>{try{const n=e[0];let r=e[1]?.body;if(!n?.includes("youtubei")||!r)return Reflect.construct(t,e,c);if((r.includes('"contentPlaybackContext"')||r.includes('"adSignalsInfo"'))&&(!r.includes('"params":"yAEB')||!r.includes('"clientScreen":"ADUNIT"'))){const n=JSON.parse(r);if(!n.context?.client)return Reflect.construct(t,e,c);n.context.client.clientScreen="ADUNIT",n.playbackContext&&(n.params=`yAEB${n.params?n.params:""}`),r=JSON.stringify(n),e[1].body=r}}catch(t){console.trace("Error occurred:",t)}return Reflect.construct(t,e,c)}};window.Request=new Proxy(window.Request,t)})();
! Fix fake buffering on the initial load
! If there will not be any issues with these rules, they perhaps can be moved to the Base filter
www.youtube.com#%#(()=>{const e={apply:(e,t,n)=>{try{let c=n[0];if(!c)return Reflect.apply(e,t,n);const r=Array.isArray(c),l=r?c[0]:c;if(l.includes('"clientScreen"')&&!l.includes('"clientScreen":"ADUNIT"')){const e=l.replace(/"clientScreen":"(WATCH_FULL_SCREEN|EMBED)"/,'"clientScreen":"ADUNIT"');r?n[0][0]=e:n[0]=e}}catch(e){}return Reflect.apply(e,t,n)}};window.XMLHttpRequest.prototype.send=new Proxy(window.XMLHttpRequest.prototype.send,e)})();
www.youtube.com#%#(()=>{const e={apply:(e,t,n)=>{try{let c=n[0];if(!c)return Reflect.apply(e,t,n);const r=Array.isArray(c),a=r?c[0]:c;if((c.includes('"contentPlaybackContext"')||c.includes('"adSignalsInfo"'))&&(!a.includes('"params":"yAEB')||!a.includes('"clientScreen":"ADUNIT"'))){const c=JSON.parse(a);if(!c.context?.client)return Reflect.apply(e,t,n);c.context.client.clientScreen="ADUNIT",c.playbackContext&&(c.params=`yAEB${c.params?c.params:""}`);const o=JSON.stringify(c);r?n[0][0]=o:n[0]=o}}catch(e){console.trace("Error occurred:",e)}return Reflect.apply(e,t,n)}};window.XMLHttpRequest.prototype.send=new Proxy(window.XMLHttpRequest.prototype.send,e)})();
www.youtube.com#%#(()=>{const e=Function.prototype.call;let t=!1,o=!1;const n={apply:(n,c,r)=>{const a=r[0];if(a?.requestNumber&&a?.snapshot)try{t=((e,t=5)=>{if("object"!=typeof e||null===e)return!1;const n=new Array(1e3);let c=0;const r=new WeakSet;for(n[c++]={obj:e,depth:0};c>0&&!o;){const{obj:e,depth:a}=n[--c];if(a>t||"object"!=typeof e||null===e||r.has(e))continue;let l;r.add(e);try{l=Object.hasOwn(e,"backoffTimeMs")}catch(e){console.trace("Error while checking for backoffTimeMs:",e)}if(l)return void 0!==e.backoffTimeMs||(o=!0,!1);for(const t in e)if(Object.hasOwn(e,t)){let o;try{o=e[t]}catch(e){console.trace("Error while accessing property:",e)}null!==o&&"object"==typeof o&&!r.has(o)&&c<n.length&&(n[c++]={obj:o,depth:a+1})}}return!1})(a),(t||o)&&(Function.prototype.call=e)}catch(e){console.trace("Error while checking for backoffTimeMs:",e)}return Reflect.apply(n,c,r)}};window.Function.prototype.call=new Proxy(window.Function.prototype.call,n),window.addEventListener("load",(()=>{if(!t)return void(Function.prototype.call=e);const o=document.querySelector(".html5-video-player"),n=window.location.search,c=new URLSearchParams(n).get("v"),r=new URLSearchParams(n).get("t")??0;if(!o||!c)return;const a=parseInt(r,10);o.loadVideoById(c,a)}))})();
! remove anti-adb
! !#if (!adguard_ext_firefox)