Only modify cues for auto-generated captions
This commit is contained in:
parent
ab4df7e078
commit
5730280325
@ -3203,7 +3203,12 @@ get "/api/v1/captions/:id" do |env|
|
|||||||
caption = caption[0]
|
caption = caption[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
caption_xml = client.get(caption.baseUrl + "&tlang=#{tlang}").body
|
url = caption.baseUrl + "&tlang=#{tlang}"
|
||||||
|
|
||||||
|
# Auto-generated captions often have cues that aren't aligned properly with the video,
|
||||||
|
# as well as some other markup that makes it cumbersome, so we try to fix that here
|
||||||
|
if caption.name.simpleText.includes? "auto-generated"
|
||||||
|
caption_xml = client.get(url).body
|
||||||
caption_xml = XML.parse(caption_xml)
|
caption_xml = XML.parse(caption_xml)
|
||||||
|
|
||||||
webvtt = <<-END_VTT
|
webvtt = <<-END_VTT
|
||||||
@ -3243,6 +3248,10 @@ get "/api/v1/captions/:id" do |env|
|
|||||||
|
|
||||||
END_CUE
|
END_CUE
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
url += "&format=vtt"
|
||||||
|
webvtt = client.get(url).body
|
||||||
|
end
|
||||||
|
|
||||||
if title = env.params.query["title"]?
|
if title = env.params.query["title"]?
|
||||||
# https://blog.fastmail.com/2011/06/24/download-non-english-filenames/
|
# https://blog.fastmail.com/2011/06/24/download-non-english-filenames/
|
||||||
|
Loading…
Reference in New Issue
Block a user