mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Fix status check for channel page
This commit is contained in:
parent
697c00dccf
commit
e21f770485
1 changed files with 8 additions and 3 deletions
|
@ -556,11 +556,11 @@ end
|
||||||
# TODO: Add "sort_by"
|
# TODO: Add "sort_by"
|
||||||
def fetch_channel_community(ucid, continuation, locale, config, kemal_config, format, thin_mode)
|
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")
|
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")
|
response = YT_POOL.client &.get("/user/#{ucid}/community?gl=US&hl=en")
|
||||||
end
|
end
|
||||||
|
|
||||||
if response.status_code == 404
|
if response.status_code != 200
|
||||||
error_message = translate(locale, "This channel does not exist.")
|
error_message = translate(locale, "This channel does not exist.")
|
||||||
raise error_message
|
raise error_message
|
||||||
end
|
end
|
||||||
|
@ -845,7 +845,7 @@ end
|
||||||
|
|
||||||
def get_about_info(ucid, locale)
|
def get_about_info(ucid, locale)
|
||||||
about = YT_POOL.client &.get("/channel/#{ucid}/about?disable_polymer=1&gl=US&hl=en")
|
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")
|
about = YT_POOL.client &.get("/user/#{ucid}/about?disable_polymer=1&gl=US&hl=en")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -853,6 +853,11 @@ def get_about_info(ucid, locale)
|
||||||
raise ChannelRedirect.new(channel_id: md["ucid"])
|
raise ChannelRedirect.new(channel_id: md["ucid"])
|
||||||
end
|
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)
|
about = XML.parse_html(about.body)
|
||||||
|
|
||||||
if about.xpath_node(%q(//div[contains(@class, "channel-empty-message")]))
|
if about.xpath_node(%q(//div[contains(@class, "channel-empty-message")]))
|
||||||
|
|
Loading…
Reference in a new issue