Skip to content

Invidious is an alternative front-end to YouTube

fix youtube api vtt format subtitle

karelrootedc251c667487d
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)