Rules-For-Quantumult-X/Scripts/AdBlock/Other/Youtube.min.js

4 lines
116 KiB
JavaScript
Raw Normal View History

2023-03-02 17:07:07 +08:00
// Build: 2023/2/24 23:01:30
2023-02-17 17:12:19 +08:00
// 非压缩状态代码可见同目录下 youtube.src.js
2023-03-02 17:07:07 +08:00
(()=>{function Wi(l){"use strict";function e(){}function n(){}var i=String.fromCharCode,t={}.toString,r=t.call(l.SharedArrayBuffer),u=t(),s=l.Uint8Array,o=s||Array,a=s?ArrayBuffer:o,f=a.isView||function(B){return B&&"length"in B},N=t.call(a.prototype);a=n.prototype;var b=l.TextEncoder,m=new(s?Uint16Array:o)(32);e.prototype.decode=function(B){if(!f(B)){var D=t.call(B);if(D!==N&&D!==r&&D!==u)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");B=s?new o(B):B||[]}for(var R=D="",g=0,x=B.length|0,re=x-32|0,U,W,$=0,v=0,S,j=0,_=-1;g<x;){for(U=g<=re?32:x-g|0;j<U;g=g+1|0,j=j+1|0){switch(W=B[g]&255,W>>4){case 15:if(S=B[g=g+1|0]&255,S>>6!==2||247<W){g=g-1|0;break}$=(W&7)<<6|S&63,v=5,W=256;case 14:S=B[g=g+1|0]&255,$<<=6,$|=(W&15)<<6|S&63,v=S>>6===2?v+4|0:24,W=W+256&768;case 13:case 12:S=B[g=g+1|0]&255,$<<=6,$|=(W&31)<<6|S&63,v=v+7|0,g<x&&S>>6===2&&$>>v&&1114112>$?(W=$,$=$-65536|0,0<=$&&(_=($>>10)+55296|0,W=($&1023)+56320|0,31>j?(m[j]=_,j=j+1|0,_=-1):(S=_,_=W,W=S))):(W>>=8,g=g-W-1|0,W=65533),$=v=0,U=g<=re?32:x-g|0;default:m[j]=W;continue;case 11:case 10:case 9:case 8:}m[j]=65533}if(R+=i(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m[8],m[9],m[10],m[11],m[12],m[13],m[14],m[15],m[16],m[17],m[18],m[19],m[20],m[21],m[22],m[23],m[24],m[25],m[26],m[27],m[28],m[29],m[30],m[31]),32>j&&(R=R.slice(0,j-32|0)),g<x){if(m[0]=_,j=~_>>>31,_=-1,R.length<D.length)continue}else _!==-1&&(R+=i(_));D+=R,R=""}return D},a.encode=function(B){B=B===void 0?"":""+B;var D=B.length|0,R=new o((D<<1)+8|0),g,x=0,re=!s;for(g=0;g<D;g=g+1|0,x=x+1|0){var U=B.charCodeAt(g)|0;if(127>=U)R[x]=U;else{if(2047>=U)R[x]=192|U>>6;else{e:{if(55296<=U)if(56319>=U){var W=B.charCodeAt(g=g+1|0)|0;if(56320<=W&&57343>=W){if(U=(U<<10)+W-56613888|0,65535<U){R[x]=240|U>>18,R[x=x+1|0]=128|U>>12&63,R[x=x+1|0]=128|U>>6&63,R[x=x+1|0]=128|U&63;continue}break e}U=65533}else 57343>=U&&(U=65533);!re&&g<<1<x&&g<<1<(x-7|0)&&(re=!0,W=new o(3*D),W.set(R),R=W)}R[x]=224|U>>12,R[x=x+1|0]=128|U>>6&63}R[x=x+1|0]=128|U&63}}return s?R.subarray(0,x):R.slice(0,x)},l.TextDecoder=e,l.TextEncoder=n}var w=Wi(globalThis);var ae=class{constructor(e,n){this.name=e||"",this.debug=n.debug||!1,e&&this.log(`${e} Start`)}isQuanX(){return typeof $task!="undefined"}isSurge(){return typeof $environment!="undefined"&&$environment["surge-version"]}isLoon(){return typeof $loon!="undefined"}isShadowrocket(){return typeof $rocket!="undefined"}isStash(){return typeof $environment!="undefined"&&$environment["stash-version"]}getval(e){let n="";return this.isSurge()||this.isLoon()||this.isStash()?n=$persistentStore.read(e):this.isQuanX()&&(n=$prefs.valueForKey(e)),n==null?void 0:n.replace(/\0/g,"")}setval(e,n){if(this.isSurge()||this.isLoon()||this.isStash())return $persistentStore.write(e,n);if(this.isQuanX())return $prefs.setValueForKey(e,n)}getjson(e,n={}){let i=this.getval(e);return i?JSON.parse(i):n}setjson(e,n){this.setval(JSON.stringify(e),n)}msg(e=this.name,n="",i="",t){let r=u=>{if(!u)return u;if(typeof u=="string")return this.isLoon()?u:this.isQuanX()?{"open-url":u}:this.isSurge()||this.isStash()?{url:u}:void 0;if(typeof u=="object"){if(this.isLoon()){let s=u.openUrl||u.url||u["open-url"],o=u.mediaUrl||u["media-url"];return{openUrl:s,mediaUrl:o}}else if(this.isQuanX()){let s=u["open-url"]||u.url||u.openUrl,o=u["media-url"]||u.mediaUrl,a=u["update-pasteboard"]||u.updatePasteboard;return{"open-url":s,"media-url":o,"update-pasteboard":a}}else if(this.isSurge()||this.isStash())return{url:u.url||u.openUrl||u["open-url"]}}else return};this.isSurge()||this.isLoon()||this.isStash()?$notification.post(e,n,i,r(t)):this.isQuanX()&&$notify(e,n,i,r(t))}log(e){this.debug&&(typeof e=="object"&&(e=JSON.stringify(e)),console.log(e))}done(e={}){$done(e)}};var C=new ae("YouTube",{debug:!1});function ue(l){let e=typeof l;if(e=="object"){if(Array.isArray(l))return"array";if(l===null)return"null"}return e}function si(l){return l!==null&&typeof l=="object"&&!Array.isArray(l)}var V="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),fe=[];for(let l
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(t){case 0:u=r,t=1;break;case 1:n[i++]=u<<2|(r&48)>>4,u=r,t=2;break;case 2:n[i++]=(u&15)<<4|(r&60)>>2,u=r,t=3;break;case 3:n[i++]=(u&3)<<6|r,t=0;break}}if(t==1)throw Error("invalid base64 string.");return n.subarray(0,i)}function li(l){let e="",n=0,i,t=0;for(let r=0;r<l.length;r++)switch(i=l[r],n){case 0:e+=V[i>>2],t=(i&3)<<4,n=1;break;case 1:e+=V[t|i>>4],t=(i&15)<<2,n=2;break;case 2:e+=V[t|i>>6],e+=V[i&63],n=0;break}return n&&(e+=V[t],e+="=",n==1&&(e+="=")),e}var c;(function(l){l.symbol=Symbol.for("protobuf-ts/unknown"),l.onRead=(n,i,t,r,u)=>{(e(i)?i[l.symbol]:i[l.symbol]=[]).push({no:t,wireType:r,data:u})},l.onWrite=(n,i,t)=>{for(let{no:r,wireType:u,data:s}of l.list(i))t.tag(r,u).raw(s)},l.list=(n,i)=>{if(e(n)){let t=n[l.symbol];return i?t.filter(r=>r.no==i):t}return[]},l.last=(n,i)=>l.list(n,i).slice(-1)[0];let e=n=>n&&Array.isArray(n[l.symbol])})(c||(c={}));var d;(function(l){l[l.Varint=0]="Varint",l[l.Bit64=1]="Bit64",l[l.LengthDelimited=2]="LengthDelimited",l[l.StartGroup=3]="StartGroup",l[l.EndGroup=4]="EndGroup",l[l.Bit32=5]="Bit32"})(d||(d={}));function ui(){let l=0,e=0;for(let i=0;i<28;i+=7){let t=this.buf[this.pos++];if(l|=(t&127)<<i,!(t&128))return this.assertBounds(),[l,e]}let n=this.buf[this.pos++];if(l|=(n&15)<<28,e=(n&112)>>4,!(n&128))return this.assertBounds(),[l,e];for(let i=3;i<=31;i+=7){let t=this.buf[this.pos++];if(e|=(t&127)<<i,!(t&128))return this.assertBounds(),[l,e]}throw new Error("invalid varint")}function de(l,e,n){for(let r=0;r<28;r=r+7){let u=l>>>r,s=!(!(u>>>7)&&e==0),o=(s?u|128:u)&255;if(n.push(o),!s)return}let i=l>>>28&15|(e&7)<<4,t=!!(e>>3);if(n.push((t?i|128:i)&255),!!t){for(let r=3;r<31;r=r+7){let u=e>>>r,s=!!(u>>>7),o=(s?u|128:u)&255;if(n.push(o),!s)return}n.push(e>>>31&1)}}var ce=(1<<16)*(1<<16);function Oe(l){let e=l[0]=="-";e&&(l=l.slice(1));let n=1e6,i=0,t=0;function r(u,s){let o=Number(l.slice(u,s));t*=n,i=i*n+o,i>=ce&&(t=t+(i/ce|0),i=i%ce)}return r(-24,-18),r(-18,-12),r(-12,-6),r(-6),[e,i,t]}function he(l,e){if(e<=2097151)return""+(ce*e+(l>>>0));let n=l&16777215,i=(l>>>24|e<<8)>>>0&16777215,t=e>>16&65535,r=n+i*6777216+t*6710656,u=i+t*8147497,s=t*2,o=1e7;r>=o&&(u+=Math.floor(r/o),r%=o),u>=o&&(s+=Math.floor(u/o),u%=o);function a(f,N){let b=f?String(f):"";return N?"0000000".slice(b.length)+b:b}return a(s,0)+a(u,s)+a(r,1)}function Ue(l,e){if(l>=0){for(;l>127;)e.push(l&127|128),l=l>>>7;e.push(l)}else{for(let n=0;n<9;n++)e.push(l&127|128),l=l>>7;e.push(1)}}function fi(){let l=this.buf[this.pos++],e=l&127;if(!(l&128))return this.assertBounds(),e;if(l=this.buf[this.pos++],e|=(l&127)<<7,!(l&128))return this.assertBounds(),e;if(l=this.buf[this.pos++],e|=(l&127)<<14,!(l&128))return this.assertBounds(),e;if(l=this.buf[this.pos++],e|=(l&127)<<21,!(l&128))return this.assertBounds(),e;l=this.buf[this.pos++],e|=(l&15)<<28;for(let n=5;l&128&&n<10;n++)l=this.buf[this.pos++];if(l&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function Oi(){let l=new DataView(new ArrayBuffer(8));return globalThis.BigInt!==void 0&&typeof l.getBigInt64=="function"&&typeof l.getBigUint64=="function"&&typeof l.setBigInt64=="function"&&typeof l.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:l}:void 0}var I=Oi();function ci(l){if(!l)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}var di=/^-?[0-9]+$/,pe=(1<<16)*(1<<16),ye=class{constructor(e,n){this.lo=e|0,this.hi=n|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*pe+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}},O=class extends ye{static from(e){if(I)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=I.C(e);case"number":if(e===0)return this.ZERO;e=I.C(e);case"bigint":if(!e)return this.ZERO;if(e<I.UMIN)throw new Error("signed value for ulong");if(e>I.UMA