From 6f4665588f0bb096576221d20fbfc2dd758d7b96 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Thu, 20 Jan 2022 22:23:21 +0100 Subject: [PATCH] search.cr: use do/end rather than inline {} block --- src/invidious/search.cr | 7 +++---- src/invidious/videos.cr | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/invidious/search.cr b/src/invidious/search.cr index 45d29059..d8971e79 100644 --- a/src/invidious/search.cr +++ b/src/invidious/search.cr @@ -27,10 +27,9 @@ def channel_search(query, page, channel) : Array(SearchItem) return [] of SearchItem if !continuation_items items = [] of SearchItem - continuation_items.as_a.select(&.as_h.has_key?("itemSectionRenderer")).each { |item| - extract_item(item["itemSectionRenderer"]["contents"].as_a[0]) - .try { |t| items << t } - } + continuation_items.as_a.select(&.as_h.has_key?("itemSectionRenderer")).each do |item| + extract_item(item["itemSectionRenderer"]["contents"].as_a[0]).try { |t| items << t } + end return items end diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index bdd7381c..d77d56d2 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -687,7 +687,7 @@ struct Video end def paid - reason = info.dig?("playabilityStatus", "reason") || "" + reason = info.dig?("playabilityStatus", "reason").try &.as_s || "" return reason.includes? "requires payment" end @@ -712,7 +712,7 @@ struct Video end def description - description = info! + description = info .dig?("microformat", "playerMicroformatRenderer", "description", "simpleText") .try &.as_s || "" end