Update #203236 youtube.com

Attempt to fix issue with "This content isn't available" error
This commit is contained in:
Adam Wróblewski
2026-01-19 13:11:33 +01:00
parent 61febb6252
commit 7c6899faa7
2 changed files with 2 additions and 2 deletions

View File

@@ -736,7 +736,7 @@ www.youtube.com#%#(()=>{let t=document.location.href,e=[],n=[],o="",r=!1;const i
! Fix ads with a specific Google account and for case when JSON.stringify is not writable
www.youtube.com#%#(()=>{const t={construct:(t,e,c)=>{try{const n=e[0];let o=e[1]?.body;if(!n?.includes("youtubei")||location.href.includes("/shorts/")||location.href.includes("youtube.com/tv")||location.href.includes("youtube.com/embed/")||!o)return Reflect.construct(t,e,c);if(o.includes('"contentPlaybackContext"')||o.includes('"adSignalsInfo"')){const n=JSON.parse(o);if(!n.context?.client)return Reflect.construct(t,e,c);n.playbackContext&&(n.playbackContext.adPlaybackContext={pyv:!0}),n.playerRequest&&(n.playerRequest.playbackContext.adPlaybackContext={pyv:!0}),o=JSON.stringify(n),e[1].body=o}}catch(t){}return Reflect.construct(t,e,c)}};window.Request=new Proxy(window.Request,t)})();
www.youtube.com#%#(()=>{const e={apply:(e,t,n)=>{if(location.href.includes("/shorts/")||location.href.includes("youtube.com/tv")||location.href.includes("youtube.com/embed/"))return Reflect.apply(e,t,n);try{let o=n[0];if(o&&(o.includes('"contentPlaybackContext"')||o.includes('"adSignalsInfo"'))){const c=JSON.parse(o);if(!c.context?.client)return Reflect.apply(e,t,n);c.playbackContext&&(c.playbackContext.adPlaybackContext={pyv:!0}),c.playerRequest&&(c.playerRequest.playbackContext.adPlaybackContext={pyv:!0}),o=JSON.stringify(c),n[0]=o}}catch(e){}return Reflect.apply(e,t,n)}};window.TextEncoder.prototype.encode=new Proxy(window.TextEncoder.prototype.encode,e)})();
www.youtube.com#%#(()=>{const t={apply:(t,e,n)=>{if(location.href.includes("/shorts/")||location.href.includes("youtube.com/tv")||location.href.includes("youtube.com/embed/"))return Reflect.apply(t,e,n);try{const a=n[0];if(!a?.context?.client)return Reflect.apply(t,e,n);a.playbackContext&&(a.playbackContext.adPlaybackContext={pyv:!0}),a.playerRequest&&(a.playerRequest.playbackContext.adPlaybackContext={pyv:!0}),n[0]=a}catch(t){}return Reflect.apply(t,e,n)}};window.JSON.stringify=new Proxy(window.JSON.stringify,t)})();
www.youtube.com#%#(()=>{const e={apply:(e,t,a)=>{if(location.href.includes("/shorts/")||location.href.includes("youtube.com/tv")||location.href.includes("youtube.com/embed/"))return Reflect.apply(e,t,a);try{const n=a[0];if(!n?.context?.client)return Reflect.apply(e,t,a);n.playbackContext&&"undefined"===parsedPayload.playbackContext.adPlaybackContext&&(n.playbackContext.adPlaybackContext={pyv:!0}),n.playerRequest&&"undefined"===n.playerRequest.playbackContext.adPlaybackContext&&(n.playerRequest.playbackContext.adPlaybackContext={pyv:!0}),a[0]=n}catch(e){}return Reflect.apply(e,t,a)}};window.JSON.stringify=new Proxy(window.JSON.stringify,e)})();
! Fix ads on https://www.youtube.com/shorts/
! https://github.com/AdguardTeam/AdguardFilters/issues/172033#issuecomment-1991263854
! TODO: remove the hints and JavaScript rule when Safari uses the latest scriptlets library (v2.2.7 or above)

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 t={apply:(t,e,n)=>{try{let a=n[0];if(!a||location.href.includes("youtube.com/tv")||location.href.includes("youtube.com/embed/"))return Reflect.apply(t,e,n);const o=Array.isArray(a),c=o?a[0]:a;if(c.includes('"contentPlaybackContext"')||c.includes('"adSignalsInfo"')){const a=JSON.parse(c);if(!a.context?.client)return Reflect.apply(t,e,n);a.playbackContext&&(a.playbackContext.adPlaybackContext={pyv:!0}),a.playerRequest&&(a.playerRequest.playbackContext.adPlaybackContext={pyv:!0});const l=JSON.stringify(a);o?n[0][0]=l:n[0]=l}}catch(t){}return Reflect.apply(t,e,n)}};window.XMLHttpRequest.prototype.send=new Proxy(window.XMLHttpRequest.prototype.send,t)})();
www.youtube.com#%#(()=>{const e="movie_player",t="ytd-watch-flexy[player-unavailable]",n="yt-playability-error-supported-renderers#error-screen:has(>*)",r="pyv",o="ad_type",a="none";let c=r;const l=e=>{c=e},y=window.location.search,d=new URLSearchParams(y).get("v"),u=new URLSearchParams(y).get("t")??"0",s=parseInt(u,10),i=()=>{const t=document.getElementById(e);if(t&&"function"==typeof t.loadVideoById)try{t.loadVideoById(d,s)}catch(e){}},p=(e,t)=>{try{if(!e||!t)return;if(t===r)return e.adPlaybackContext={pyv:!0};if(t===o)return e.adPlaybackContext={adType:"AD_TYPE_INSTREAM"};if(t===a)return delete e.adPlaybackContext}catch(e){}};(()=>{const e={apply:(e,t,n)=>{try{let r=n[0];if(!r||location.href.includes("youtube.com/tv")||location.href.includes("youtube.com/embed/"))return Reflect.apply(e,t,n);const o=Array.isArray(r),a=o?r[0]:r;if(!a.includes('"contentPlaybackContext"')&&!a.includes('"adSignalsInfo"'))return Reflect.apply(e,t,n);const l=JSON.parse(a);if(!l.context?.client)return Reflect.apply(e,t,n);l.playbackContext&&p(l.playbackContext,c),l.playerRequest&&p(l.playerRequest.playbackContext,c);const y=JSON.stringify(l);o?n[0][0]=y:n[0]=y}catch(e){}return Reflect.apply(e,t,n)}};window.XMLHttpRequest.prototype.send=new Proxy(window.XMLHttpRequest.prototype.send,e)})();const m=document.documentElement,f=new MutationObserver((()=>{c===a&&f.disconnect(),(()=>{const r=document.getElementById(e),o=document.querySelector(n),a=document.querySelector(t);if(!r)return!1;const c=r.getVideoData?.();return!(!o&&!a&&null===c?.errorCode)})()&&(c===r?((()=>{const r=document.getElementById(e),o=document.querySelector(n),a=document.querySelector(t);r&&a&&(o?.style.setProperty("display","none","important"),a?.removeAttribute("player-unavailable"))})(),l(o),i()):c===o&&(l(a),i(),f.disconnect()))}));f.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)