API: Add bitrate to formatStreams too (#4590)

Before this PR, the bitrate was only returned for the 'adaptiveFormats'.
They are now also returned the 'formatStreams'.

No linked issue
This commit is contained in:
Samantaz Fox 2024-04-26 23:49:44 +02:00
commit 8eaaeb1c74
No known key found for this signature in database
GPG Key ID: F42821059186176E
1 changed files with 2 additions and 0 deletions

View File

@ -161,6 +161,8 @@ module Invidious::JSONify::APIv1
json.field "type", fmt["mimeType"] json.field "type", fmt["mimeType"]
json.field "quality", fmt["quality"] json.field "quality", fmt["quality"]
json.field "bitrate", fmt["bitrate"].as_i.to_s if fmt["bitrate"]?
fmt_info = Invidious::Videos::Formats.itag_to_metadata?(fmt["itag"]) fmt_info = Invidious::Videos::Formats.itag_to_metadata?(fmt["itag"])
if fmt_info if fmt_info
fps = fmt_info["fps"]?.try &.to_i || fmt["fps"]?.try &.as_i || 30 fps = fmt_info["fps"]?.try &.to_i || fmt["fps"]?.try &.as_i || 30