NewPipeExtractor icon indicating copy to clipboard operation
NewPipeExtractor copied to clipboard

[YouTube] Add JavaScript lexer to parse completely throttling decryption function

Open Theta-Dev opened this issue 3 years ago • 0 comments

fixes #902

I added a proper javascript lexer to extract the nsig function. The old naive implementation broke because of regexes containing curly braces.

I copied the tokenizer from Rhino because it is private and removed unneeded function. On top of that I had to add logic to determine whether a slash constitutes a regex delimiter or a division operator. I have adapted that from the RESS library.

I also found an issue with the Rhino JS interpreter. Version 1.7.14 uses javax.lang.model.SourceVersion, which is not available on android. This causes the app to load indefinitely when opening a video. If you have any idea how to fix this without downgrading, please help me. I have no idea why this error did not occur before. Checked with the debugger, the error occurs when executing the (correctly extracted) javascript. Perhaps the new deobfuscation function uses a feature of the interpreter which causes it to load the class with the failing import. https://github.com/mozilla/rhino/issues/1149

For now I downgraded Rhino to v1.7.13.

Theta-Dev avatar Aug 20 '22 12:08 Theta-Dev