mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-15 01:25:08 +00:00
Add 404 status code on all possible endpoints
This commit is contained in:
@@ -31,7 +31,12 @@ def get_about_info(ucid, locale) : AboutChannel
|
||||
end
|
||||
|
||||
if initdata.dig?("alerts", 0, "alertRenderer", "type") == "ERROR"
|
||||
raise InfoException.new(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."
|
||||
raise NotFoundException.new(error_message)
|
||||
else
|
||||
raise InfoException.new(error_message)
|
||||
end
|
||||
end
|
||||
|
||||
if browse_endpoint = initdata["onResponseReceivedActions"]?.try &.[0]?.try &.["navigateAction"]?.try &.["endpoint"]?.try &.["browseEndpoint"]?
|
||||
|
||||
@@ -6,7 +6,7 @@ def fetch_channel_community(ucid, continuation, locale, format, thin_mode)
|
||||
end
|
||||
|
||||
if response.status_code != 200
|
||||
raise InfoException.new("This channel does not exist.")
|
||||
raise NotFoundException.new("This channel does not exist.")
|
||||
end
|
||||
|
||||
ucid = response.body.match(/https:\/\/www.youtube.com\/channel\/(?<ucid>UC[a-zA-Z0-9_-]{22})/).not_nil!["ucid"]
|
||||
@@ -49,7 +49,11 @@ def fetch_channel_community(ucid, continuation, locale, format, thin_mode)
|
||||
error_message = (message["text"]["simpleText"]? ||
|
||||
message["text"]["runs"]?.try &.[0]?.try &.["text"]?)
|
||||
.try &.as_s || ""
|
||||
raise InfoException.new(error_message)
|
||||
if error_message == "This channel does not exist."
|
||||
raise NotFoundException.new(error_message)
|
||||
else
|
||||
raise InfoException.new(error_message)
|
||||
end
|
||||
end
|
||||
|
||||
response = JSON.build do |json|
|
||||
|
||||
Reference in New Issue
Block a user