From c251c667487d4f2362d9527afb3c8d69cd089d0b Mon Sep 17 00:00:00 2001 From: karelrooted Date: Wed, 1 Nov 2023 11:40:06 +0800 Subject: [PATCH] fix youtube api vtt format subtitle for fmt=vtt to work the fmt parameter in the original caption api url need to be replaced --- src/invidious/routes/api/v1/videos.cr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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?("