mirror of
https://github.com/iv-org/invidious.git
synced 2026-08-17 13:30:53 -05:00
Potential fix for pull request finding
Hardening via `.try &.as_h?` makes sense - not sure if YT would ever return null Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
09fe7557d6
commit
9752768d58
@ -154,18 +154,21 @@ module Invidious::JSONify::APIv1
|
|||||||
# one audio track. The same data already drives the DASH manifest
|
# one audio track. The same data already drives the DASH manifest
|
||||||
# (see `Invidious::Routes::API::Manifest`), but was never exposed on
|
# (see `Invidious::Routes::API::Manifest`), but was never exposed on
|
||||||
# the API, leaving clients to scrape `xtags` out of the stream URL.
|
# the API, leaving clients to scrape `xtags` out of the stream URL.
|
||||||
if audio_track = fmt["audioTrack"]?
|
if audio_track = fmt["audioTrack"]?.try &.as_h?
|
||||||
json.field "audioTrack" do
|
json.field "audioTrack" do
|
||||||
json.object do
|
json.object do
|
||||||
# Language tag with a track discriminator, e.g. "en-US.4".
|
if id = audio_track["id"]?
|
||||||
json.field "id", audio_track["id"] if audio_track["id"]?
|
json.field "id", id
|
||||||
# Human-readable label, e.g. "English (original)".
|
end
|
||||||
json.field "displayName", audio_track["displayName"] if audio_track["displayName"]?
|
if display_name = audio_track["displayName"]?
|
||||||
# True for the video's original (undubbed) audio.
|
json.field "displayName", display_name
|
||||||
json.field "audioIsDefault", audio_track["audioIsDefault"] if audio_track["audioIsDefault"]?
|
end
|
||||||
end
|
if audio_is_default = audio_track["audioIsDefault"]?
|
||||||
end
|
json.field "audioIsDefault", audio_is_default
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Extra misc stuff
|
# Extra misc stuff
|
||||||
json.field "colorInfo", fmt["colorInfo"] if fmt.has_key?("colorInfo")
|
json.field "colorInfo", fmt["colorInfo"] if fmt.has_key?("colorInfo")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user