Skip to content
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

feat(StreamsExtractor): generate PoToken #7069

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

FineFindus
Copy link
Contributor

@FineFindus FineFindus commented Feb 3, 2025

Implements support for locally generating PoTokens using the device web view. This is a direct port of
TeamNewPipe/NewPipe#11955 to native Kotlin.
However, there are some notable differences:

  • NewPipe use an additional PoTokenGenerator interface. As there is only one implementation right now, this is skipped
  • NewPipe handles broken web views on older devices. Since we're increasing minSdk in BREAKING CHANGE: bump minSdk to 26 #7047, I'm hoping we can get away without

It is marked as a draft, since while it does generate valid PoTokens, playback does not work (Source error: open failed: ENOENT; help is appreciated).

Closes: #7065

@gechoto gechoto mentioned this pull request Feb 3, 2025
3 tasks
@Figim

This comment was marked as spam.

@FineFindus
Copy link
Contributor Author

Please don't add unnecessary comments. Linking an issue to be closed is fine, but the rest just adds noise. I'm already well aware of the NewPipe PR (see description above).

@Figim
Copy link

Figim commented Feb 4, 2025

Please don't add unnecessary comments. Linking an issue to be closed is fine, but the rest just adds noise. I'm already well aware of the NewPipe PR (see description above).

Sorry.

  1. "Source Error" only occurs if "HLS" is enabled. DASH works great. tested

  2. Live streams also play smoothly on HLS

@Bnyro
Copy link
Member

Bnyro commented Feb 4, 2025

The crash log is a temporary DNS issue on your side, that's not LibreTube related.

@Figim
Copy link

Figim commented Feb 4, 2025

A source error still occurs when starting a video in HLS.

XRecorder_20250205_01.mp4

@Figim Figim mentioned this pull request Feb 5, 2025
2 tasks
Implements support for locally generating PoTokens using the device
webview. This is a direct port of
TeamNewPipe/NewPipe#11955 to native Kotlin.

Closes: libre-tube#7065
@FineFindus
Copy link
Contributor Author

FineFindus commented Feb 5, 2025

A few questions:

  • Since HLS does not work with potokens either, should it be removed/disabled?
  • JavaScriptUtil.kt uses nanojson, should it be ported as well? I left it for now, as it would make it easier to follow future changes. There isn't any noticable impact on filesize, since it is already included in NewPipeExtractor.

@YT-Advanced
Copy link

  • Since HLS does not work with potokens either, should it be removed/disabled?

This issues seem to be NewPipeExtractor bug itself, since HLS don't need pot but it still be appended in streaming url

  • JavaScriptUtil.kt uses nanojson, should it be ported as well? I left it for now, as it would make it easier to follow future changes.

Uhm u should port it also

@gechoto
Copy link

gechoto commented Feb 5, 2025

With the current code the purpose of JavaScriptUtil.kt is not perfectly clear at first look and it might take a while to notice that this is for po tokens.
The class and function names are pretty generic.
For example in the first function it says something about some "challenge data". Yeah cool, which challenge data? Someone new to the project won't know.

I suggest to do one of these to make it more obvious it is about po tokens:

  • Move JavaScriptUtil.kt and PoTokenWebView.kt to a sub-package named potoken
  • Rename JavaScriptUtil.kt to something like PoTokenJavaScriptUtil.kt
  • Rename the functions and extend the documentation in JavaScriptUtil.kt to make it clear this is for po tokens

NewPipe did the first option here and put everything po token related into a sub package:
https://github.com/TeamNewPipe/NewPipe/tree/dev/app/src/main/java/org/schabi/newpipe/util/potoken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

High priority: Support PR like NewPipe to use Extractor PoToken
5 participants