summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2024-08-24 19:39:36 +0200
committerSamantaz Fox <coding@samantaz.fr>2024-08-24 19:39:36 +0200
commit828da3c6ce0a147c0e2c58de0e62dea97deb0db7 (patch)
tree654892435171ead3bab48da24f5a93a0df78cebd
parentfebf18cbf724715101e55e261062c23691ff39ad (diff)
parentc606465708720c953c37032624ff31e5e9d841ab (diff)
downloadinvidious-828da3c6ce0a147c0e2c58de0e62dea97deb0db7.tar.gz
invidious-828da3c6ce0a147c0e2c58de0e62dea97deb0db7.tar.bz2
invidious-828da3c6ce0a147c0e2c58de0e62dea97deb0db7.zip
API: Proxy formatStreams URLs too (#4859)
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
-rw-r--r--src/invidious/jsonify/api_v1/video_json.cr8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/invidious/jsonify/api_v1/video_json.cr b/src/invidious/jsonify/api_v1/video_json.cr
index 59714828..e4379601 100644
--- a/src/invidious/jsonify/api_v1/video_json.cr
+++ b/src/invidious/jsonify/api_v1/video_json.cr
@@ -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"]