Skip to content

Commit

Permalink
fix youtube api vtt format subtitle
Browse files Browse the repository at this point in the history
for fmt=vtt to work the fmt parameter in the original caption api url need to be replaced
  • Loading branch information
karelrooted committed Nov 14, 2023
1 parent c5b87e3 commit c251c66
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/invidious/routes/api/v1/videos.cr
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ module Invidious::Routes::API::V1::Videos
end
end
else
webvtt = YT_POOL.client &.get("#{url}&fmt=vtt").body
uri = URI.parse(url)
query_params = uri.query_params
query_params["fmt"] = "vtt"
uri.query_params = query_params
webvtt = YT_POOL.client &.get(uri.request_target).body

if webvtt.starts_with?("<?xml")
webvtt = caption.timedtext_to_vtt(webvtt)
Expand Down

0 comments on commit c251c66

Please sign in to comment.