Fix missing hash key: "availableCountries" (Closes #3047)
This commit is contained in:
parent
0e3820b634
commit
99bc230fe6
@ -54,9 +54,6 @@ def get_about_info(ucid, locale) : AboutChannel
|
|||||||
banner = banners.try &.[-1]?.try &.["url"].as_s?
|
banner = banners.try &.[-1]?.try &.["url"].as_s?
|
||||||
|
|
||||||
description_node = initdata["header"]["interactiveTabbedHeaderRenderer"]["description"]
|
description_node = initdata["header"]["interactiveTabbedHeaderRenderer"]["description"]
|
||||||
|
|
||||||
is_family_friendly = initdata["microformat"]["microformatDataRenderer"]["familySafe"].as_bool
|
|
||||||
allowed_regions = initdata["microformat"]["microformatDataRenderer"]["availableCountries"].as_a.map(&.as_s)
|
|
||||||
else
|
else
|
||||||
author = initdata["metadata"]["channelMetadataRenderer"]["title"].as_s
|
author = initdata["metadata"]["channelMetadataRenderer"]["title"].as_s
|
||||||
author_url = initdata["metadata"]["channelMetadataRenderer"]["channelUrl"].as_s
|
author_url = initdata["metadata"]["channelMetadataRenderer"]["channelUrl"].as_s
|
||||||
@ -74,13 +71,17 @@ def get_about_info(ucid, locale) : AboutChannel
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
description_node = initdata["metadata"]["channelMetadataRenderer"]?.try &.["description"]?
|
description_node = initdata["metadata"]["channelMetadataRenderer"]?.try &.["description"]?
|
||||||
|
end
|
||||||
|
|
||||||
is_family_friendly = initdata["microformat"]["microformatDataRenderer"]["familySafe"].as_bool
|
is_family_friendly = initdata["microformat"]["microformatDataRenderer"]["familySafe"].as_bool
|
||||||
allowed_regions = initdata["microformat"]["microformatDataRenderer"]["availableCountries"].as_a.map(&.as_s)
|
|
||||||
end
|
allowed_regions = initdata
|
||||||
|
.dig?("microformat", "microformatDataRenderer", "availableCountries")
|
||||||
|
.try &.as_a.map(&.as_s) || [] of String
|
||||||
|
|
||||||
description = !description_node.nil? ? description_node.as_s : ""
|
description = !description_node.nil? ? description_node.as_s : ""
|
||||||
description_html = HTML.escape(description)
|
description_html = HTML.escape(description)
|
||||||
|
|
||||||
if !description_node.nil?
|
if !description_node.nil?
|
||||||
if description_node.as_h?.nil?
|
if description_node.as_h?.nil?
|
||||||
description_node = text_to_parsed_content(description_node.as_s)
|
description_node = text_to_parsed_content(description_node.as_s)
|
||||||
|
Loading…
Reference in New Issue
Block a user