From 4aa96ecab9319df15677d16e73351b88ee990050 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Wed, 1 Dec 2021 17:32:10 +0100 Subject: [PATCH] Use 'dig()' in 'find()' statements --- src/invidious/videos.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index db94110b4..e20fb386c 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -897,7 +897,7 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ if toplevel_buttons likes_button = toplevel_buttons.as_a - .find(&.["toggleButtonRenderer"]["defaultIcon"]["iconType"].as_s.== "LIKE") + .find(&.dig("toggleButtonRenderer", "defaultIcon", "iconType").as_s.== "LIKE") .try &.["toggleButtonRenderer"] if likes_button @@ -910,7 +910,7 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ end dislikes_button = toplevel_buttons.as_a - .find(&.["toggleButtonRenderer"]["defaultIcon"]["iconType"].as_s.== "DISLIKE") + .find(&.dig("toggleButtonRenderer", "defaultIcon", "iconType").as_s.== "DISLIKE") .try &.["toggleButtonRenderer"] if dislikes_button