From d2b01c635baa1366210eb761c50552325c05f08f Mon Sep 17 00:00:00 2001 From: syeopite Date: Tue, 19 Sep 2023 13:25:06 -0700 Subject: [PATCH] Use short-hand block notation for parsing chapters --- src/invidious/videos/parser.cr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr index c5dd5c89..f10836be 100644 --- a/src/invidious/videos/parser.cr +++ b/src/invidious/videos/parser.cr @@ -382,11 +382,11 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any # Yes,`decoratedPlayerBarRenderer` is repeated twice. if player_bar = player_overlays.try &.dig?("decoratedPlayerBarRenderer", "decoratedPlayerBarRenderer", "playerBar") if markers = player_bar.dig?("multiMarkersPlayerBarRenderer", "markersMap") - potential_chapters_array = markers.as_a.find { |m| m["key"]? == "DESCRIPTION_CHAPTERS" } + potential_chapters_array = markers.as_a.find(&.["key"]?.try &.== "DESCRIPTION_CHAPTERS") - # Let manual chapters have higher precedence than automatically generated ones. + # Chapters that are manually created should have a higher precedence than automatically generated chapters if !potential_chapters_array - potential_chapters_array = markers.as_a.find { |m| m["key"]? == "AUTO_CHAPTERS" } + potential_chapters_array = markers.as_a.find(&.["key"]?.try &.== "AUTO_CHAPTERS") end if potential_chapters_array