Add new error message to use NotFoundException instead

This commit is contained in:
Fijxu 2026-08-17 02:56:08 -04:00
parent 8f3c7d2d44
commit e2083c1edd
No known key found for this signature in database
GPG Key ID: 32C1DDF333EDA6A4
3 changed files with 8 additions and 3 deletions

View File

@ -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)

View File

@ -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

View File

@ -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