mirror of
https://github.com/iv-org/invidious.git
synced 2026-09-07 09:33:04 -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,
|
verified : Bool,
|
||||||
is_age_gated : 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
|
def get_about_info(ucid) : AboutChannel
|
||||||
begin
|
begin
|
||||||
# Fetch channel information from channel home page
|
# 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"
|
if initdata.dig?("alerts", 0, "alertRenderer", "type") == "ERROR"
|
||||||
error_message = initdata["alerts"][0]["alertRenderer"]["text"]["simpleText"].as_s
|
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)
|
raise NotFoundException.new(error_message)
|
||||||
else
|
else
|
||||||
raise InfoException.new(error_message)
|
raise InfoException.new(error_message)
|
||||||
|
|||||||
@ -161,7 +161,7 @@ def fetch_channel(ucid, pull_all_videos : Bool)
|
|||||||
|
|
||||||
# Deleted channels raise a `InfoException` exception.
|
# Deleted channels raise a `InfoException` exception.
|
||||||
begin
|
begin
|
||||||
channel = get_about_info(ucid, nil)
|
channel = get_about_info(ucid)
|
||||||
rescue ex
|
rescue ex
|
||||||
raise ex
|
raise ex
|
||||||
end
|
end
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class Invidious::Jobs::RefreshChannelsJob < Invidious::Jobs::BaseJob
|
|||||||
end
|
end
|
||||||
rescue ex
|
rescue ex
|
||||||
LOGGER.error("RefreshChannelsJob: #{id} : #{ex.message}")
|
LOGGER.error("RefreshChannelsJob: #{id} : #{ex.message}")
|
||||||
if ex.is_a?(InfoException)
|
if ex.is_a?(NotFoundException)
|
||||||
Invidious::Database::Channels.update_mark_deleted(id)
|
Invidious::Database::Channels.update_mark_deleted(id)
|
||||||
else
|
else
|
||||||
lim_fibers = 1
|
lim_fibers = 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user