summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkarelrooted <karelrooted@gmail.com>2023-11-01 11:40:06 +0800
committerkarelrooted <karelrooted@gmail.com>2023-11-14 13:16:08 +0800
commitc251c667487d4f2362d9527afb3c8d69cd089d0b (patch)
tree0dded7c143a4e8bcbc5ed0989c8bb45fd3e4762b /src
parentc5b87e3b5e5cc7f7f5c8baa7732bd6d81d8f910a (diff)
downloadinvidious-c251c667487d4f2362d9527afb3c8d69cd089d0b.tar.gz
invidious-c251c667487d4f2362d9527afb3c8d69cd089d0b.tar.bz2
invidious-c251c667487d4f2362d9527afb3c8d69cd089d0b.zip
fix youtube api vtt format subtitle
for fmt=vtt to work the fmt parameter in the original caption api url need to be replaced
Diffstat (limited to 'src')
-rw-r--r--src/invidious/routes/api/v1/videos.cr6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/invidious/routes/api/v1/videos.cr b/src/invidious/routes/api/v1/videos.cr
index 1017ac9d..3bead06a 100644
--- a/src/invidious/routes/api/v1/videos.cr
+++ b/src/invidious/routes/api/v1/videos.cr
@@ -136,7 +136,11 @@ module Invidious::Routes::API::V1::Videos
end
end
else
- webvtt = YT_POOL.client &.get("#{url}&fmt=vtt").body
+ uri = URI.parse(url)
+ query_params = uri.query_params
+ query_params["fmt"] = "vtt"
+ uri.query_params = query_params
+ webvtt = YT_POOL.client &.get(uri.request_target).body
if webvtt.starts_with?("<?xml")
webvtt = caption.timedtext_to_vtt(webvtt)