mirror of
https://github.com/iv-org/invidious.git
synced 2025-05-19 04:51:10 +00:00
fix: safely access "label" key
Fixes https://github.com/iv-org/invidious/issues/5095 On some videos, `label` is missing from the video information. Invidious assumed that the `label` key existed. Videos with label have this inside `metadataBadgeRenderer`: ``` {"style" => "BADGE_STYLE_TYPE_SIMPLE", "label" => "4K", "trackingParams" => "COMDENwwGAoiEwiCrebe6JWNAxWIxz8EHSQRFTU="} ``` but other videos, for some reason, look like this: ``` {"icon" => {"iconType" => "PERSON_RADAR"}, "style" => "BADGE_STYLE_TYPE_SIMPLE", "trackingParams" => "CM4DENwwGAsiEwiCrebe6JWNAxWIxz8EHSQRFTU="} ```
This commit is contained in:
parent
d1bc15b8bf
commit
b120abdcc5
@ -115,7 +115,7 @@ private module Parsers
|
||||
badges = VideoBadges::None
|
||||
item_contents["badges"]?.try &.as_a.each do |badge|
|
||||
b = badge["metadataBadgeRenderer"]
|
||||
case b["label"].as_s
|
||||
case b["label"]?.try &.as_s
|
||||
when "LIVE"
|
||||
badges |= VideoBadges::LiveNow
|
||||
when "New"
|
||||
|
Loading…
x
Reference in New Issue
Block a user