Integrate transcript captions into captions API

This commit is contained in:
syeopite
2023-07-23 05:02:02 -07:00
parent caac7e2166
commit e4942b188f
5 changed files with 91 additions and 54 deletions

View File

@@ -85,7 +85,13 @@ module Invidious::Videos
lines = [] of TranscriptLine
body.each do |line|
# Transcript section headers. They are not apart of the captions and as such we can safely skip them.
if line.as_h.has_key?("transcriptSectionHeaderRenderer")
next
end
line = line["transcriptSegmentRenderer"]
start_ms = line["startMs"].as_s.to_i.millisecond
end_ms = line["endMs"].as_s.to_i.millisecond