Skip to content

Commit

Permalink
API: Proxy formatStreams URLs too (#4859)
Browse files Browse the repository at this point in the history
The /api/v1/videos endpoint does not proxy the formatStreams URLs when
'local=true' is passed, whereas the adaptiveFormats URLs are correctly proxied.

The Web UI does proxy when clicking "Download" with 'fmt=18' for example, so
this is probably an oversight. This PR aims to fix that.

No related issue
  • Loading branch information
SamantazFox committed Aug 24, 2024
2 parents febf18c + c606465 commit 828da3c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/invidious/jsonify/api_v1/video_json.cr
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,13 @@ module Invidious::JSONify::APIv1
json.array do
video.fmt_stream.each do |fmt|
json.object do
json.field "url", fmt["url"]
if proxy
json.field "url", Invidious::HttpServer::Utils.proxy_video_url(
fmt["url"].to_s, absolute: true
)
else
json.field "url", fmt["url"]
end
json.field "itag", fmt["itag"].as_i.to_s
json.field "type", fmt["mimeType"]
json.field "quality", fmt["quality"]
Expand Down

0 comments on commit 828da3c

Please sign in to comment.