mirror of
https://gitea.invidious.io/iv-org/invidious.git
synced 2024-08-15 00:53:41 +00:00
Captions: Use 'fmt=vtt' instead of 'format=vtt' (#4152)
This commit is contained in:
commit
cf7c49deb0
1 changed files with 8 additions and 8 deletions
|
@ -136,17 +136,17 @@ module Invidious::Routes::API::V1::Videos
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# Some captions have "align:[start/end]" and "position:[num]%"
|
webvtt = YT_POOL.client &.get("#{url}&fmt=vtt").body
|
||||||
# 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
|
|
||||||
if webvtt.starts_with?("<?xml")
|
if webvtt.starts_with?("<?xml")
|
||||||
webvtt = caption.timedtext_to_vtt(webvtt)
|
webvtt = caption.timedtext_to_vtt(webvtt)
|
||||||
else
|
else
|
||||||
webvtt = YT_POOL.client &.get("#{url}&format=vtt").body
|
# Some captions have "align:[start/end]" and "position:[num]%"
|
||||||
.gsub(/([0-9:.]{12} --> [0-9:.]{12}).+/, "\\1")
|
# 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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue