Skip to content

Fix download of HLS videos#3204

Open
Titaniumtown wants to merge 2 commits intofuto-org:masterfrom
Titaniumtown:fix/hls-download-auth-modifier
Open

Fix download of HLS videos#3204
Titaniumtown wants to merge 2 commits intofuto-org:masterfrom
Titaniumtown:fix/hls-download-auth-modifier

Conversation

@Titaniumtown
Copy link

While working on an issue with the Floatplane plugin. I ran across an issue with the HLS download implementation.

Playback via HLS works fine, but downloading via HLS didn't work!

Basically what was happening here is that the request modifier function is not being kept preserved throughout the video download process. So the end result is an unauthenticated attempt to download the video (which will obviously fail).

I am no expert in this codebase, so extensive feedback and nitpicking is welcome and appreciated!

Note: I also had to fix a pre-existing test that was failing to compile, but I can drop this commit if someone else pushes a fix.

I had Claude do Red-Green testing, so it created a test. I can drop this if requested.

I don't know grayjay's policy on LLM contribution (I tried to find it), so I apologize if this change is unwanted due to how it was created.

LLMs used: Claude Opus 4.6 via opencode

The catch block in onConsoleMessage was missing a return statement, causing a compile error.
When downloading HLS content, the plugin's requestModifier (auth) was lost
during variant expansion. JSHLSManifestSource (which carries the modifier) was
expanded into HLSVariantVideoUrlSource objects (plain data classes without
modifier support). The 'is JSSource' check at download time then returned null,
causing encryption key fetches to fail with 403.

Fix: eagerly extract IRequestModifier from the original JSSource during the
prepare phase and store it in transient fields. Pass the captured modifier
directly to downloadHlsSource/downloadFileSource instead of relying on the
'is JSSource' type check against the expanded variant. Applied to both video
and audio paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants