|
|
|
@ -32,10 +32,10 @@ module Invidious::Videos
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def timedtext_to_vtt(timedtext : String, tlang = nil) : String
|
|
|
|
|
#In the future, we could just directly work with the url. This is more of a POC
|
|
|
|
|
# In the future, we could just directly work with the url. This is more of a POC
|
|
|
|
|
cues = [] of XML::Node
|
|
|
|
|
tree = XML.parse(timedtext)
|
|
|
|
|
tree = tree.children.first()
|
|
|
|
|
tree = tree.children.first
|
|
|
|
|
|
|
|
|
|
tree.children.each do |item|
|
|
|
|
|
if item.name == "body"
|
|
|
|
@ -55,7 +55,7 @@ module Invidious::Videos
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
END_VTT
|
|
|
|
|
cues.each_with_index do |node,i|
|
|
|
|
|
cues.each_with_index do |node, i|
|
|
|
|
|
start_time = node["t"].to_f.milliseconds
|
|
|
|
|
|
|
|
|
|
duration = node["d"]?.try &.to_f.milliseconds
|
|
|
|
@ -217,6 +217,5 @@ module Invidious::Videos
|
|
|
|
|
"Yoruba",
|
|
|
|
|
"Zulu",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|