-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[YouTube] Add JavaScript lexer to parse completely throttling decryption function #905
[YouTube] Add JavaScript lexer to parse completely throttling decryption function #905
Conversation
- fixed checkstyle warnings
fix handling of template literals improve tokenizer error msgs
…x-throttling-decrypter2
…x-throttling-decrypter2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)?
.../src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeThrottlingDecrypter.java
Outdated
Show resolved
Hide resolved
extractor/src/main/java/org/schabi/newpipe/extractor/utils/jsextractor/JavaScriptExtractor.java
Outdated
Show resolved
Hide resolved
extractor/src/main/java/org/schabi/newpipe/extractor/utils/jsextractor/JavaScriptExtractor.java
Outdated
Show resolved
Hide resolved
extractor/src/main/java/org/schabi/newpipe/extractor/utils/jsextractor/JavaScriptExtractor.java
Outdated
Show resolved
Hide resolved
extractor/src/main/java/org/schabi/newpipe/extractor/utils/jsextractor/Lexer.java
Show resolved
Hide resolved
extractor/src/test/java/org/schabi/newpipe/extractor/utils/JavaScriptExtractorTest.java
Outdated
Show resolved
Hide resolved
extractor/src/test/java/org/schabi/newpipe/extractor/utils/JavaScriptExtractorTest.java
Outdated
Show resolved
Hide resolved
extractor/src/main/java/org/schabi/newpipe/extractor/utils/jsextractor/JavaScriptExtractor.java
Show resolved
Hide resolved
extractor/src/test/java/org/schabi/newpipe/extractor/utils/JavaScriptExtractorTest.java
Outdated
Show resolved
Hide resolved
extractor/src/test/java/org/schabi/newpipe/extractor/utils/JavaScriptExtractorTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you again for all the efforts you put to fix this issue!
Your changes look good now to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
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.
For now I downgraded Rhino to v1.7.13.
(This part was done in a separate PR.)