Use a regex to fix badly aligned captions

pull/2872/head
Samantaz Fox 2022-02-07 22:18:24 +01:00
rodzic 170e754998
commit d12dff9dcf
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: F42821059186176E
1 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -130,7 +130,13 @@ 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
.gsub(/([0-9:.]+ --> [0-9:.]+).+/, "\\1")
end
if title = env.params.query["title"]?