diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr index 0468202d..72965c79 100644 --- a/src/invidious/videos/parser.cr +++ b/src/invidious/videos/parser.cr @@ -99,7 +99,7 @@ If you are the administrator, install Invidious Companion: \ # Stop here if video is not found, or private with no further data. # For other statuses (UNPLAYABLE, etc.), continue to extract as much # data as possible from the /next endpoint. - if reason == "Video unavailable" && !{"UNPLAYABLE"}.any?(playability_status) + if reason == "Video unavailable" && playability_status != "UNPLAYABLE" return { "version" => JSON::Any.new(Video::SCHEMA_VERSION.to_i64), "reason" => JSON::Any.new(reason), @@ -282,7 +282,8 @@ If you are the administrator, install Invidious Companion: \ live_now = microformat.dig?("liveBroadcastDetails", "isLiveNow") .try &.as_bool - live_now ||= video_details.dig?("isLive").try &.as_bool || false + live_now ||= video_details.dig?("isLive").try &.as_bool + live_now ||= video_primary_renderer.try &.dig?("viewCount", "videoViewCountRenderer", "isLive").try &.as_bool || false post_live_dvr = video_details.dig?("isPostLiveDvr") .try &.as_bool || false diff --git a/src/invidious/yt_backend/extractors_utils.cr b/src/invidious/yt_backend/extractors_utils.cr index d83b5764..9c299a03 100644 --- a/src/invidious/yt_backend/extractors_utils.cr +++ b/src/invidious/yt_backend/extractors_utils.cr @@ -69,20 +69,9 @@ rescue ex end def has_unlisted_badge?(badges : JSON::Any?) - return false if badges.nil? - - badges.as_a.each do |badge| - icon_type = badge.dig("metadataBadgeRenderer", "icon", "iconType").as_s - - return true if icon_type == "PRIVACY_UNLISTED" - end - - return false -rescue ex - LOGGER.debug("Unable to parse badges for unlisted check. Got exception: #{ex.message}") - LOGGER.trace("Badges data: #{badges.to_json}") - - return false + return badges.try &.as_a.any? { |badge| + badge.dig?("metadataBadgeRenderer", "icon", "iconType").try &.as_s == "PRIVACY_UNLISTED" + } || false end # This function extracts SearchVideo items from a Category.