Check for existance of "adaptiveFormats" in videos

Combined from commits:
- Check for existance of "adaptiveFormats" in videos
- Remove usage of ternary conditional
This commit is contained in:
syeopite 2021-08-12 12:26:50 -07:00 committed by GitHub
parent 3e4fab7070
commit cea38de4ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -765,8 +765,8 @@ struct Video
info["microformat"]?.try &.["playerMicroformatRenderer"]["isFamilySafe"]?.try &.as_bool || false
end
def is_vr : Bool
info["streamingData"]?.try &.["adaptiveFormats"].as_a[0]?.try &.["projectionType"].as_s == "MESH" ? true : false || false
def is_vr : Bool?
info.dig?("streamingData", "adaptiveFormats", 0, "projectionType").try &.as_s == "MESH"
end
def wilson_score : Float64