[YouTube] Add JavaScript lexer to parse completely throttling decryption function#905
Merged
AudricV merged 18 commits intoTeamNewPipe:devfrom Sep 24, 2022
Merged
Conversation
- fixed checkstyle warnings
fix handling of template literals improve tokenizer error msgs
…x-throttling-decrypter2
…x-throttling-decrypter2
AudricV
requested changes
Aug 30, 2022
Member
AudricV
left a comment
There was a problem hiding this comment.
Thank you for taking care of this fix! Could you please rebase your PR (and so drop the Rhino version downgrade change that you made yourself)?
AudricV
approved these changes
Sep 8, 2022
Member
AudricV
left a comment
There was a problem hiding this comment.
Thank you again for all the efforts you put to fix this issue!
Your changes look good now to me.
Stypox
approved these changes
Sep 11, 2022
Member
There was a problem hiding this comment.
I think this approach looks good, and if we find any better way to do this in the future we can still undo this pretty easily. Code also looks good (I obviously didn't review the copied-over code). Thank you @Theta-Dev!
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Details
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/1149For now I downgraded Rhino to v1.7.13.
(This part was done in a separate PR.)