diff --git a/metadata.json b/metadata.json index dd23bf6d..2c56362c 100644 --- a/metadata.json +++ b/metadata.json @@ -31,6 +31,22 @@ }, "resourcePath": "de-amp.js" }, + { + "name": "cbs", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "cbs.js" + }, + { + "name": "cbs0", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "cbs0.js" + }, { "name": "touch-fix", "aliases": [], @@ -39,4 +55,4 @@ }, "resourcePath": "touch-fix.js" } -] \ No newline at end of file +] diff --git a/resources/cbs.js b/resources/cbs.js new file mode 100644 index 00000000..033210ce --- /dev/null +++ b/resources/cbs.js @@ -0,0 +1,20 @@ +/// cbs.js +(() => { + window.XMLHttpRequest.prototype.open = new Proxy(window.XMLHttpRequest.prototype.open, { + apply: async (a, b, c) => { + const d = c[1]; + return "string" != typeof d || 0 === d.length ? Reflect.apply(a, b, c) : (d.match(/pubads\.g\.doubleclick.net\/ondemand\/hls\/.*\.m3u8/) && b.addEventListener("readystatechange", function() { + if (4 === b.readyState) { + const a = b.response; + Object.defineProperty(b, "response", { + writable: !0 + }), Object.defineProperty(b, "responseText", { + writable: !0 + }); + const c = a.replaceAll(/#EXTINF:(\d|\d\.\d+)\,\nhttps:\/\/redirector\.googlevideo\.com\/videoplayback\?[\s\S]*?&source=dclk_video_ads&[\s\S]*?\n/g, ""); + b.response = c, b.responseText = c + } + }), Reflect.apply(a, b, c)) + } + }) +})(); diff --git a/resources/cbs0.js b/resources/cbs0.js new file mode 100644 index 00000000..aad3e21d --- /dev/null +++ b/resources/cbs0.js @@ -0,0 +1,16 @@ +/// cbs0.js +(() => { + const a = window.fetch; + window.fetch = new Proxy(window.fetch, { + apply: async (b, c, d) => { + const e = d[0]; + if ("string" != typeof e || 0 === e.length) return Reflect.apply(b, c, d); + if (e.match(/pubads\.g\.doubleclick\.net\/ondemand\/.*\/content\/.*\/vid\/.*\/streams\/.*\/manifest\.mpd|pubads\.g\.doubleclick.net\/ondemand\/hls\/.*\.m3u8/)) { + const b = await a(...d); + let c = await b.text(); + return c = c.replaceAll(/