mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-22 13:37:24 +00:00
fix youtube api vtt format subtitle
for fmt=vtt to work the fmt parameter in the original caption api url need to be replaced
This commit is contained in:
parent
c5b87e3b5e
commit
c251c66748
@ -136,7 +136,11 @@ module Invidious::Routes::API::V1::Videos
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
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")
|
if webvtt.starts_with?("<?xml")
|
||||||
webvtt = caption.timedtext_to_vtt(webvtt)
|
webvtt = caption.timedtext_to_vtt(webvtt)
|
||||||
|
Loading…
Reference in New Issue
Block a user