summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2023-10-21 18:32:28 +0200
committerSamantaz Fox <coding@samantaz.fr>2023-10-21 18:32:28 +0200
commitcf7c49deb00aecd86f1908497b4f2380df35a788 (patch)
treea26773f7b38ed41a6c57265d0a3335d1353f9df2 /src
parentd543a68a84e134d43424d068f3580d64635ebc27 (diff)
parent0aebac5f3e4848da5deb8fc9b656831d5f7622df (diff)
downloadinvidious-cf7c49deb00aecd86f1908497b4f2380df35a788.tar.gz
invidious-cf7c49deb00aecd86f1908497b4f2380df35a788.tar.bz2
invidious-cf7c49deb00aecd86f1908497b4f2380df35a788.zip
Captions: Use 'fmt=vtt' instead of 'format=vtt' (#4152)
Diffstat (limited to 'src')
-rw-r--r--src/invidious/routes/api/v1/videos.cr16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/invidious/routes/api/v1/videos.cr b/src/invidious/routes/api/v1/videos.cr
index 449c9f9b..1017ac9d 100644
--- a/src/invidious/routes/api/v1/videos.cr
+++ b/src/invidious/routes/api/v1/videos.cr
@@ -136,17 +136,17 @@ module Invidious::Routes::API::V1::Videos
end
end
else
- # Some captions have "align:[start/end]" and "position:[num]%"
- # attributes. Those are causing issues with VideoJS, which is unable
- # to properly align the captions on the video, so we remove them.
- #
- # See: https://github.com/iv-org/invidious/issues/2391
- webvtt = YT_POOL.client &.get("#{url}&format=vtt").body
+ webvtt = YT_POOL.client &.get("#{url}&fmt=vtt").body
+
if webvtt.starts_with?("<?xml")
webvtt = caption.timedtext_to_vtt(webvtt)
else
- webvtt = YT_POOL.client &.get("#{url}&format=vtt").body
- .gsub(/([0-9:.]{12} --> [0-9:.]{12}).+/, "\\1")
+ # Some captions have "align:[start/end]" and "position:[num]%"
+ # attributes. Those are causing issues with VideoJS, which is unable
+ # to properly align the captions on the video, so we remove them.
+ #
+ # See: https://github.com/iv-org/invidious/issues/2391
+ webvtt = webvtt.gsub(/([0-9:.]{12} --> [0-9:.]{12}).+/, "\\1")
end
end
end