summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@protonmail.com>2020-02-28 15:57:45 -0500
committerOmar Roth <omarroth@protonmail.com>2020-02-28 15:57:45 -0500
commite21f77048579bc42f52d462bd3d41a68312fb157 (patch)
treec346ef4acf39d85fed8cfc5c863d269a3b03e52c
parent697c00dccf02730ed1af2d71595af0177ac1baad (diff)
downloadinvidious-e21f77048579bc42f52d462bd3d41a68312fb157.tar.gz
invidious-e21f77048579bc42f52d462bd3d41a68312fb157.tar.bz2
invidious-e21f77048579bc42f52d462bd3d41a68312fb157.zip
Fix status check for channel page
-rw-r--r--src/invidious/channels.cr11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/invidious/channels.cr b/src/invidious/channels.cr
index e5cfb10f..35ef5df2 100644
--- a/src/invidious/channels.cr
+++ b/src/invidious/channels.cr
@@ -556,11 +556,11 @@ end
# TODO: Add "sort_by"
def fetch_channel_community(ucid, continuation, locale, config, kemal_config, format, thin_mode)
response = YT_POOL.client &.get("/channel/#{ucid}/community?gl=US&hl=en")
- if response.status_code == 404
+ if response.status_code != 200
response = YT_POOL.client &.get("/user/#{ucid}/community?gl=US&hl=en")
end
- if response.status_code == 404
+ if response.status_code != 200
error_message = translate(locale, "This channel does not exist.")
raise error_message
end
@@ -845,7 +845,7 @@ end
def get_about_info(ucid, locale)
about = YT_POOL.client &.get("/channel/#{ucid}/about?disable_polymer=1&gl=US&hl=en")
- if about.status_code == 404
+ if about.status_code != 200
about = YT_POOL.client &.get("/user/#{ucid}/about?disable_polymer=1&gl=US&hl=en")
end
@@ -853,6 +853,11 @@ def get_about_info(ucid, locale)
raise ChannelRedirect.new(channel_id: md["ucid"])
end
+ if about.status_code != 200
+ error_message = translate(locale, "This channel does not exist.")
+ raise error_message
+ end
+
about = XML.parse_html(about.body)
if about.xpath_node(%q(//div[contains(@class, "channel-empty-message")]))