From c72febe7a6ed294240eb8ad596b2f60f502f5fa3 Mon Sep 17 00:00:00 2001 From: syeopite Date: Tue, 3 Aug 2021 00:59:04 -0700 Subject: [PATCH] Handle invalid attribution_links in brand_redirect --- src/invidious/routes/channels.cr | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index 4e8db368..9876936f 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -115,12 +115,11 @@ class Invidious::Routes::Channels < Invidious::Routes::BaseRoute begin resolved_url = YoutubeAPI.resolve_url("https://youtube.com#{env.request.path}#{yt_url_params.size > 0 ? "?#{yt_url_params}" : ""}") - rescue ex : InfoException - raise InfoException.new("This channel does not exist.") + ucid = resolved_url["endpoint"]["browseEndpoint"]["browseId"] + rescue ex : InfoException | KeyError + raise InfoException.new(translate(locale, "This channel does not exist.")) end - ucid = resolved_url["endpoint"]["browseEndpoint"]["browseId"] - selected_tab = env.request.path.split("/")[-1] if ["home", "videos", "playlists", "community", "channels", "about"].includes? selected_tab url = "/channel/#{ucid}/#{selected_tab}"