Skip to content

feat: route to invidious companion on downloads#5224

Merged
unixfox merged 1 commit intoiv-org:masterfrom
alexmaras:feat/download-through-companion
May 2, 2025
Merged

feat: route to invidious companion on downloads#5224
unixfox merged 1 commit intoiv-org:masterfrom
alexmaras:feat/download-through-companion

Conversation

@alexmaras
Copy link
Copy Markdown
Contributor

@alexmaras alexmaras commented Mar 29, 2025

This sets the download URL to invidious companion (as enabled in iv-org/invidious-companion#41) when companion is used.

There is a secondary way of approaching this - proxying the download through invidious. However, it looks like the CompanionConnectionPool is set up to only have a short timeout, and a download endpoint will need to allow for long requests.

Note that this approach embeds the companion URL in the page, which means the check param would eventually expire. It looks like that's 6 hours though, so I'm not sure that's too much of a concern.

There's also a couple of extra bits needed in companion to make this work well, all in iv-org/invidious-companion#95
That PR does 2 things:

  1. chunks up downloads so that companion isn't throttled by youtube servers
  2. ensures the check query param is passed on to the latestVersion call that's made so that it doesn't error out.

Without that PR merged, this still works, but only if verify_request is false in invidious-companion.

Addresses #5218

@alexmaras alexmaras requested a review from a team as a code owner March 29, 2025 07:06
@alexmaras alexmaras requested review from SamantazFox and removed request for a team March 29, 2025 07:06
@unixfox unixfox merged commit 8fd0b82 into iv-org:master May 2, 2025
8 checks passed
str << "<form"
str << " class=\"pure-form pure-form-stacked\""
str << " action='/download'"
str << " action='#{url}'"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs to be URL encoded!

Suggested change
str << " action='#{url}'"
str << " action='" << URI.encode_www_form(url) << "'"

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.

3 participants