diff --git a/src/core/Player.ts b/src/core/Player.ts index 4df4b8189..4728a6ac3 100644 --- a/src/core/Player.ts +++ b/src/core/Player.ts @@ -221,12 +221,20 @@ export default class Player { } static extractNSigSourceCode(data: string): string { - const sc = `function descramble_nsig(a) { let b=a.split("")${getStringBetweenStrings(data, 'b=a.split("")', '}return b.join("")}')}} return b.join(""); } descramble_nsig(nsig)`; + let sc = getStringBetweenStrings(data, 'b=a.split("")', '}return b.join("")}'); - if (!sc) - Log.warn(Player.TAG, 'Failed to extract n-token decipher algorithm'); + if (sc) + return `function descramble_nsig(a) { let b=a.split("")${sc}} return b.join(""); } descramble_nsig(nsig)`; - return sc; + sc = getStringBetweenStrings(data, 'b=String.prototype.split.call(a,"")', '}return Array.prototype.join.call(b,"")}'); + + if (sc) + return `function descramble_nsig(a) { let b=String.prototype.split.call(a, "")${sc}} return Array.prototype.join.call(b, ""); } descramble_nsig(nsig)`; + + // We really should throw an error here to avoid errors later, returning a pass-through function for backwards-compatibility + Log.warn(TAG, 'Failed to extract n-token decipher algorithm'); + + return 'function descramble_nsig(a) { return a; } descramble_nsig(nsig)'; } get url(): string { @@ -248,4 +256,4 @@ export default class Player { static get LIBRARY_VERSION(): number { return 2; } -} \ No newline at end of file +}