Fix "cast from Nil to Bool failed"

pull/3077/head
Samantaz Fox 2022-05-01 21:11:12 +02:00
rodzic f5fb4c6c64
commit b84ce6a556
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: F42821059186176E
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -614,7 +614,7 @@ struct Video
end end
def author_verified : Bool def author_verified : Bool
info["authorVerified"].try &.as_bool || false info["authorVerified"]?.try &.as_bool || false
end end
def sub_count_text : String def sub_count_text : String
@ -1093,7 +1093,8 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_
author_thumbnail = author_info.try &.dig?("thumbnail", "thumbnails", 0, "url") author_thumbnail = author_info.try &.dig?("thumbnail", "thumbnails", 0, "url")
author_verified_badge = author_info.try &.dig?("badges", 0, "metadataBadgeRenderer", "tooltip") author_verified_badge = author_info.try &.dig?("badges", 0, "metadataBadgeRenderer", "tooltip")
params["authorVerified"] = JSON::Any.new((author_verified_badge && author_verified_badge == "Verified")) author_verified = (!author_verified_badge.nil? && author_verified_badge == "Verified")
params["authorVerified"] = JSON::Any.new(author_verified)
params["authorThumbnail"] = JSON::Any.new(author_thumbnail.try &.as_s || "") params["authorThumbnail"] = JSON::Any.new(author_thumbnail.try &.as_s || "")