Skip to content

[YouTube] Fix signature deobfuscation function name extraction #1290

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

Merged
merged 5 commits into from
Jul 11, 2025

Conversation

FineFindus
Copy link
Contributor

Adds a new regex to find the signature deobfuscation function that works for the new 20830619 player. The regex is taken from #1287 (comment), I suspect it originated from yt-dlp, as they use an almost identical one.

Closes: #1287
Ref: #1287 (comment)

  • I carefully read the contribution guidelines and agree to them.
  • I have tested the API against NewPipe.
  • I agree to create a pull request for NewPipe as soon as possible to make it compatible with the changed API.

@AudricV AudricV added bug Issue is related to a bug youtube service, https://www.youtube.com/ labels Mar 31, 2025
@FineFindus FineFindus force-pushed the fix/deobfuscation-function branch from 92cd0b0 to 0e54ccb Compare April 5, 2025 06:22
@AudricV AudricV changed the title [YouTube] add new deobfuscation function regex [YouTube] Fix deobfuscation function name extraction Apr 5, 2025
@AlternativeOne
Copy link

At this point of time, I think, it makes sense to think about separating this "deobfuscation function name extraction" part of code (or even some more) into some form that could be easily updated without updating the app.

FineFindus added a commit to FineFindus/LibreTube that referenced this pull request Apr 9, 2025
Switches from the official NewPipeExtractor versions to a soft fork,
allowing fixes and other improvements that have not yet been merged
upstream.
For now it just contains a fix for working with newer YT player versions
and checks if a video is avialable.

Ref: TeamNewPipe/NewPipeExtractor#1290
Ref: libre-tube#7113
FineFindus added a commit to FineFindus/LibreTube that referenced this pull request Apr 9, 2025
Switches from the official NewPipeExtractor versions to a soft fork,
allowing fixes and other improvements that have not yet been merged
upstream. For now, it just contains a fix for working with newer YT
player versions and checks if a video is available.

Ref: TeamNewPipe/NewPipeExtractor#1290
Ref: libre-tube#7113
Ref: https://github.com/libre-tube/NewPipeExtractor
reocat pushed a commit to reocat/OuterTune that referenced this pull request Apr 15, 2025
Switches from the official NewPipeExtractor versions to a soft fork,
allowing fixes and other improvements that have not yet been merged
upstream. For now, it just contains a fix for working with newer YT
player versions and checks if a video is available.

Ref: TeamNewPipe/NewPipeExtractor#1290
Ref: libre-tube/LibreTube#7113
Ref: https://github.com/libre-tube/NewPipeExtractor
mostafaalagamy added a commit to mostafaalagamy/Metrolist that referenced this pull request Apr 15, 2025
Switches from the official NewPipeExtractor versions to a soft fork,
allowing fixes and other improvements that have not yet been merged
upstream. For now, it just contains a fix for working with newer YT
player versions and checks if a video is available.

Ref: TeamNewPipe/NewPipeExtractor#1290
Ref: libre-tube/LibreTube#7113
Ref: https://github.com/libre-tube/NewPipeExtractor

Co-authored-by: reocat <[email protected]>
@gechoto
Copy link
Contributor

gechoto commented Apr 15, 2025

Hi @FineFindus thanks for working on this.
Do you also plan to incorporate a fix for #1289 in your fork?

reocat pushed a commit to reocat/OuterTune that referenced this pull request Apr 15, 2025
Switches from the official NewPipeExtractor versions to a soft fork,
allowing fixes and other improvements that have not yet been merged
upstream. For now, it just contains a fix for working with newer YT
player versions and checks if a video is available.

Ref: TeamNewPipe/NewPipeExtractor#1290
Ref: libre-tube/LibreTube#7113
Ref: https://github.com/libre-tube/NewPipeExtractor
@FineFindus
Copy link
Contributor Author

Do you also plan to incorporate a fix for #1289 in your fork?

Not unless there is a corresponding PR here, but I'm also not aware of any fix.

@ShareASmile ShareASmile added the ready for review Most of the work is done, PR is now ready for a review label Apr 16, 2025
@gechoto
Copy link
Contributor

gechoto commented Apr 20, 2025

Not unless there is a corresponding PR here, but I'm also not aware of any fix.

yt-dlp has it working but it still needs to be ported to NewPipeExtractor

reocat pushed a commit to reocat/OuterTune that referenced this pull request Apr 23, 2025
Switches from the official NewPipeExtractor versions to a soft fork,
allowing fixes and other improvements that have not yet been merged
upstream. For now, it just contains a fix for working with newer YT
player versions and checks if a video is available.

Ref: TeamNewPipe/NewPipeExtractor#1290
Ref: libre-tube/LibreTube#7113
Ref: https://github.com/libre-tube/NewPipeExtractor
@FineFindus
Copy link
Contributor Author

I won't stop you from porting it :)

Copy link
Member

@AudricV AudricV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work anymore, YouTube has changed again its code. Could you please update the regular expression you added to support latest YouTube JavaScript code?

@AudricV AudricV removed the ready for review Most of the work is done, PR is now ready for a review label May 24, 2025
@FineFindus FineFindus force-pushed the fix/deobfuscation-function branch from 0e54ccb to 60d3b71 Compare May 26, 2025 19:42
@FineFindus
Copy link
Contributor Author

With the players I'm getting, this still finds the correct function, however the function structure itself has changed and now also relies on a global variable. Implemented support for it in 60d3b71.

@FineFindus FineFindus force-pushed the fix/deobfuscation-function branch from 60d3b71 to 04deb5d Compare May 27, 2025 06:06
FineFindus added a commit to FineFindus/LibreTube that referenced this pull request May 27, 2025
Updates the NewPipeExtractor to the lastest version of our fork to include the
improvements to the signature and throttling issues.

Ref: TeamNewPipe/NewPipeExtractor#1290
Ref: TeamNewPipe/NewPipeExtractor#1302
@AudricV AudricV changed the title [YouTube] Fix deobfuscation function name extraction [YouTube] Fix signature deobfuscation function name extraction Jun 1, 2025
FineFindus added a commit to FineFindus/LibreTube that referenced this pull request Jun 29, 2025
Updates the NewPipeExtractor to the lastest version of our fork to include the
improvements to the signature and throttling issues.

Ref: TeamNewPipe/NewPipeExtractor#1290
Ref: TeamNewPipe/NewPipeExtractor#1302
Copy link
Member

@litetex litetex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently not working:

Failed to find pattern "(var [A-Z]='.*'.split\(";"\))"
org.schabi.newpipe.extractor.utils.Parser$RegexException: Failed to find pattern "(var [A-Z]='.*'.split\(";"\))"
	at app//org.schabi.newpipe.extractor.utils.Parser.matchGroup(Parser.java:73)
	at app//org.schabi.newpipe.extractor.utils.Parser.matchGroup(Parser.java:60)
	at app//org.schabi.newpipe.extractor.utils.Parser.matchGroup1(Parser.java:49)
	at app//org.schabi.newpipe.extractor.services.youtube.YoutubeSignatureUtils.getDeobfuscationCode(YoutubeSignatureUtils.java:95)
	at app//org.schabi.newpipe.extractor.services.youtube.YoutubeJavaScriptPlayerManager.deobfuscateSignature(YoutubeJavaScriptPlayerManager.java:145)
	at app//org.schabi.newpipe.extractor.services.youtube.YoutubeSignaturesTest.testSignatureDeobfuscation(YoutubeSignaturesTest.java:54)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:580)
	at [email protected]/java.util.Optional.ifPresent(Optional.java:178)

Adds a new regex to find the signature deobfuscation function, which
works for the new `20830619` player.

Closes: TeamNewPipe#1287
Ref: TeamNewPipe#1287 (comment)
Extracts the global variable used in newer signature deobfuscation functions,
such as the one found in the `59b252b9` player.
@FineFindus FineFindus force-pushed the fix/deobfuscation-function branch from 04deb5d to 1915dc6 Compare July 11, 2025 06:28
@FineFindus
Copy link
Contributor Author

Looks like the use allow case letters and single quotes now. Should now work again.

@litetex litetex dismissed stale reviews from AudricV and themself July 11, 2025 18:14

Outdated

Copy link
Member

@litetex litetex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I will update the mocks and then we can merge this :)

@litetex litetex merged commit ebb53fb into TeamNewPipe:dev Jul 11, 2025
3 checks passed
@FineFindus FineFindus deleted the fix/deobfuscation-function branch July 11, 2025 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug youtube service, https://www.youtube.com/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[YouTube] Could not find signature deobfuscation function
7 participants