mirror of
https://github.com/iv-org/invidious.git
synced 2026-09-06 00:52:45 -05:00
Add new error message to use NotFoundException instead
This commit is contained in:
parent
8f3c7d2d44
commit
e2083c1edd
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user