search.cr: use do/end rather than inline {} block

pull/2827/head
Samantaz Fox 2022-01-20 22:23:21 +01:00
rodzic 63e1165936
commit 6f4665588f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: F42821059186176E
2 zmienionych plików z 5 dodań i 6 usunięć

Wyświetl plik

@ -27,10 +27,9 @@ def channel_search(query, page, channel) : Array(SearchItem)
return [] of SearchItem if !continuation_items return [] of SearchItem if !continuation_items
items = [] of SearchItem items = [] of SearchItem
continuation_items.as_a.select(&.as_h.has_key?("itemSectionRenderer")).each { |item| continuation_items.as_a.select(&.as_h.has_key?("itemSectionRenderer")).each do |item|
extract_item(item["itemSectionRenderer"]["contents"].as_a[0]) extract_item(item["itemSectionRenderer"]["contents"].as_a[0]).try { |t| items << t }
.try { |t| items << t } end
}
return items return items
end end

Wyświetl plik

@ -687,7 +687,7 @@ struct Video
end end
def paid def paid
reason = info.dig?("playabilityStatus", "reason") || "" reason = info.dig?("playabilityStatus", "reason").try &.as_s || ""
return reason.includes? "requires payment" return reason.includes? "requires payment"
end end
@ -712,7 +712,7 @@ struct Video
end end
def description def description
description = info! description = info
.dig?("microformat", "playerMicroformatRenderer", "description", "simpleText") .dig?("microformat", "playerMicroformatRenderer", "description", "simpleText")
.try &.as_s || "" .try &.as_s || ""
end end