Skip to content

Commit

Permalink
refactor(Player): Remove regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRT committed Jul 31, 2024
1 parent 210c523 commit 998095a
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/core/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,21 +221,10 @@ export default class Player {
}

static extractNSigSourceCode(data: string): string | undefined {
const match = data.match(/b=(?:a\.split\(|String\.prototype\.split\.call\(a,)\n?(?:""|\("",""\))\).*?\}return (?:b\.join\(|Array\.prototype\.join\.call\(b,)\n?(?:""|\("",""\))\)\}/s);

if (!match) {
Log.error(TAG, 'Failed to extract nsig decipher algorithm using regex. Trying another method..');

const nsig_function = findFunction(data, { includes: 'enhanced_except' });

if (nsig_function) {
return `${nsig_function.result} ${nsig_function.name}(nsig);`;
}

return;
const nsig_function = findFunction(data, { includes: 'enhanced_except' });
if (nsig_function) {
return `${nsig_function.result} ${nsig_function.name}(nsig);`;
}

return `function descrambleNsig(a) { let ${match[0]} descrambleNsig(nsig)`;
}

get url(): string {
Expand Down

0 comments on commit 998095a

Please sign in to comment.