From e2083c1eddc3af4b47e8c7b3d4ce63b363ee0e5c Mon Sep 17 00:00:00 2001 From: Fijxu Date: Mon, 17 Aug 2026 02:56:08 -0400 Subject: [PATCH] Add new error message to use NotFoundException instead --- src/invidious/channels/about.cr | 7 ++++++- src/invidious/channels/channels.cr | 2 +- src/invidious/jobs/refresh_channels_job.cr | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index 247f628a0..da7ec452c 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -19,6 +19,11 @@ record AboutChannel, verified : Bool, is_age_gated : Bool +private DELETED_CHANNEL_ERROR_MESSAGES = { + "This channel does not exist.", + "This account has been terminated for a violation of YouTube's Terms of Service.", +} + def get_about_info(ucid) : AboutChannel begin # Fetch channel information from channel home page @@ -29,7 +34,7 @@ def get_about_info(ucid) : AboutChannel if initdata.dig?("alerts", 0, "alertRenderer", "type") == "ERROR" error_message = initdata["alerts"][0]["alertRenderer"]["text"]["simpleText"].as_s - if error_message == "This channel does not exist." + if DELETED_CHANNEL_ERROR_MESSAGES.includes?(error_message) raise NotFoundException.new(error_message) else raise InfoException.new(error_message) diff --git a/src/invidious/channels/channels.cr b/src/invidious/channels/channels.cr index ac32a0066..c33157d2a 100644 --- a/src/invidious/channels/channels.cr +++ b/src/invidious/channels/channels.cr @@ -161,7 +161,7 @@ def fetch_channel(ucid, pull_all_videos : Bool) # Deleted channels raise a `InfoException` exception. begin - channel = get_about_info(ucid, nil) + channel = get_about_info(ucid) rescue ex raise ex end diff --git a/src/invidious/jobs/refresh_channels_job.cr b/src/invidious/jobs/refresh_channels_job.cr index 575511c16..283bd951d 100644 --- a/src/invidious/jobs/refresh_channels_job.cr +++ b/src/invidious/jobs/refresh_channels_job.cr @@ -43,7 +43,7 @@ class Invidious::Jobs::RefreshChannelsJob < Invidious::Jobs::BaseJob end rescue ex LOGGER.error("RefreshChannelsJob: #{id} : #{ex.message}") - if ex.is_a?(InfoException) + if ex.is_a?(NotFoundException) Invidious::Database::Channels.update_mark_deleted(id) else lim_fibers = 1