Update #203236 youtube.com

This commit is contained in:
Adam Wróblewski
2026-01-23 10:06:56 +01:00
parent 9deaa6c645
commit 66eeb8cfee

View File

@@ -4,7 +4,7 @@
!
! 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="movie_player",t="ytd-watch-flexy[player-unavailable]",n=`#${e} > .ytp-error`,o="yt-playability-error-supported-renderers#error-screen:has(>*)",r="pyv",c="ad_type",a="none";let d=r;const i=new Set,l=()=>{const e=window.location.search,t=new URLSearchParams(e).get("v"),n=new URLSearchParams(e).get("t")??"0";return{videoId:t,timeInSeconds:parseInt(n,10)}},u=()=>{const t=document.getElementById(e);if(t&&"function"==typeof t.loadVideoById)try{const{videoId:e,timeInSeconds:n}=l();t.loadVideoById(e,n)}catch(e){}},s=e=>{try{if(!e)return!1;const{videoId:t}=l();if(!t)return!1;s._lastVideoId===t&&s._lastState===e?s._count=(s._count||0)+1:(s._lastVideoId=t,s._lastState=e,s._count=1);const n=s._count>=2;return n&&(s._count=0),n}catch(e){return!1}},y=e=>{d=e},p=()=>{const n=document.getElementById(e),r=document.querySelector(o),c=document.querySelector(t);n&&c&&(r?.style.setProperty("display","none","important"),c?.removeAttribute("player-unavailable"))},f=(e,t)=>{try{if(!e||!t)return;if(t===r)return void(e.adPlaybackContext={pyv:!0});if(t===c)return void(e.adPlaybackContext={adType:"AD_TYPE_INSTREAM"});if(t===a)return void delete e.adPlaybackContext}catch(e){}};(()=>{const e={apply:(e,t,n)=>{try{let o=n[0];if(!o||location.href.includes("youtube.com/tv")||location.href.includes("youtube.com/embed/"))return Reflect.apply(e,t,n);const r=Array.isArray(o),c=r?o[0]:o;if("string"!=typeof c)return Reflect.apply(e,t,n);if(!c.includes('"contentPlaybackContext"')&&!c.includes('"adSignalsInfo"'))return Reflect.apply(e,t,n);const a=JSON.parse(c);if(!a.context?.client)return Reflect.apply(e,t,n);a.playbackContext&&f(a.playbackContext,d),a.playerRequest&&f(a.playerRequest.playbackContext,d);const i=JSON.stringify(a);r?n[0][0]=i:n[0]=i}catch(e){}return Reflect.apply(e,t,n)}};window.XMLHttpRequest.prototype.send=new Proxy(window.XMLHttpRequest.prototype.send,e)})();const m=document.documentElement;new MutationObserver((()=>{if(document.querySelector(o)&&p(),!(()=>{const r=document.getElementById(e),c=document.querySelector(n),a=document.querySelector(o),d=document.querySelector(t);if(!r)return!1;const i=r.getVideoData?.();return!(!(a||d||c)||null==i?.errorCode)})())return;const{videoId:f}=l();if((e=>{if(e)for(const t of i)t!==e&&i.delete(t)})(f),d===r){if(!s(c))return p(),void u();y(c),p(),u()}else if(d===c){if(!s(a))return p(),void u();y(a),p(),u()}else if(d===a){const{videoId:e}=l();if(!e||i.has(e))return void p();i.add(e),p(),u()}})).observe(m,{attributes:!0,childList:!0,subtree:!0})})();
www.youtube.com#%#(()=>{const e="movie_player",t="ytd-watch-flexy[player-unavailable]",r=`#${e} > .ytp-error`,n="yt-playability-error-supported-renderers#error-screen:has(>*)",o="pyv",a="ad_type",c="none";let l=o;const i=new Set,d=()=>{const t=document.getElementById(e),r=window.location.search,n=new URLSearchParams(r).get("v")||t?.getVideoData?.().video_id,o=new URLSearchParams(r).get("t")??"0";return{videoId:n,timeInSeconds:parseInt(o,10)}},y=()=>{p();const t=document.getElementById(e);if(t&&"function"==typeof t.loadVideoById)try{const{videoId:e,timeInSeconds:r}=d();t.loadVideoById(e,r)}catch(e){}},u=(()=>{let e=null,t=null,r=0;return n=>{try{if(!n)return!1;const{videoId:o}=d();return!!o&&(e===o&&t===n?r++:(e=o,t=n,r=1),r>=2&&(r=0,!0))}catch(e){return!1}}})(),s=e=>{l=e},p=()=>{const r=document.getElementById(e),o=document.querySelector(n),a=document.querySelector("yt-playability-error-supported-renderers.ytdMiniplayerPlayerContainerPlayabilityError:has(>*)"),c=document.querySelector(t);r&&(c||a)&&(o?.style.setProperty("display","none","important"),a?.style.setProperty("display","none","important"),c?.removeAttribute("player-unavailable"))},f=(e,t)=>{try{if(!e||!t)return;if(t===o)return void(e.adPlaybackContext={pyv:!0});if(t===a)return void(e.adPlaybackContext={adType:"AD_TYPE_INSTREAM"});if(t===c)return void delete e.adPlaybackContext}catch(e){}};(()=>{const e={apply:(e,t,r)=>{try{let n=r[0];if(!n||location.href.includes("youtube.com/tv")||location.href.includes("youtube.com/embed/"))return Reflect.apply(e,t,r);const o=Array.isArray(n),a=o?n[0]:n;if("string"!=typeof a)return Reflect.apply(e,t,r);if(!a.includes('"contentPlaybackContext"')&&!a.includes('"adSignalsInfo"'))return Reflect.apply(e,t,r);const c=JSON.parse(a);if(!c.context?.client)return Reflect.apply(e,t,r);c.playbackContext&&f(c.playbackContext,l),c.playerRequest&&f(c.playerRequest.playbackContext,l);const i=JSON.stringify(c);o?r[0][0]=i:r[0]=i}catch(e){}return Reflect.apply(e,t,r)}};window.XMLHttpRequest.prototype.send=new Proxy(window.XMLHttpRequest.prototype.send,e)})();const m=document.documentElement;new MutationObserver((()=>{if(document.querySelector(n)&&p(),!(()=>{const o=document.getElementById(e),a=document.querySelector(r),c=document.querySelector(n),l=document.querySelector(t);if(!o)return!1;const i=o.getVideoData?.();return(c||l||a)&&null!=i?.errorCode})())return;const{videoId:f}=d();(e=>{if(e)for(const t of i)t!==e&&i.delete(t)})(f),(()=>{if(l===o){if(!u(a))return void y();s(a),y()}else if(l===a){if(!u(c))return void y();s(c),y()}else if(l===c){const{videoId:e}=d();if(!e||i.has(e))return void p();i.add(e),y()}})()})).observe(m,{attributes:!0,childList:!0,subtree:!0})})();
www.youtube.com#%#(()=>{const t=Function.prototype.call;let e=!1,o=!1,n=!1;const c={apply:(c,r,a)=>{const l=a[0];if(l?.requestNumber&&l?.snapshot)try{o=((t,e=5)=>{if("object"!=typeof t||null===t)return!1;const o=new Array(1e3);let c=0;const r=new WeakSet;for(o[c++]={obj:t,depth:0};c>0&&!n;){const{obj:t,depth:a}=o[--c];if(a>e||"object"!=typeof t||null===t||r.has(t))continue;let l;r.add(t);try{l=Object.hasOwn(t,"backoffTimeMs")}catch(t){}if(l)return void 0!==t.backoffTimeMs||(n=!0,!1);for(const e in t)if(Object.hasOwn(t,e)){let n;try{n=t[e]}catch(t){}null!==n&&"object"==typeof n&&!r.has(n)&&c<o.length&&(o[c++]={obj:n,depth:a+1})}}return!1})(l),e=!0,(o||n)&&(Function.prototype.call=t)}catch(t){}return Reflect.apply(c,r,a)}};window.Function.prototype.call=new Proxy(window.Function.prototype.call,c);window.addEventListener("load",(async()=>{if(Function.prototype.call=t,!o&&e)return;const n=window.location.search,c=new URLSearchParams(n).get("v");if(!c)return;const r=await(a="#movie_player",l=200,i=1e4,new Promise((t=>{if(!a||!l||!i)return void t(null);const e=Date.now()+i,o=()=>{const n=document.querySelector(a);n?t(n):Date.now()>e?t(null):setTimeout(o,l)};o()})));var a,l,i;if(!r)return;const s=new URLSearchParams(n).get("t")??"0",u=parseInt(s,10);if("function"==typeof r.loadVideoById)try{r.loadVideoById(c,u)}catch(t){}}))})();
! remove anti-adb
! !#if (!adguard_ext_firefox)