mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Fix handling for non-existent channels
This commit is contained in:
parent
ceff2763a5
commit
be601a7584
1 changed files with 8 additions and 3 deletions
|
@ -190,11 +190,16 @@ def get_about_info(ucid)
|
||||||
client = make_client(YT_URL)
|
client = make_client(YT_URL)
|
||||||
|
|
||||||
about = client.get("/channel/#{ucid}/about?disable_polymer=1&gl=US&hl=en")
|
about = client.get("/channel/#{ucid}/about?disable_polymer=1&gl=US&hl=en")
|
||||||
|
if about.status_code == 404
|
||||||
|
about = client.get("/user/#{ucid}/about?disable_polymer=1&gl=US&hl=en")
|
||||||
|
end
|
||||||
|
|
||||||
about = XML.parse_html(about.body)
|
about = XML.parse_html(about.body)
|
||||||
|
|
||||||
if !about.xpath_node(%q(//span[contains(@class,"qualified-channel-title-text")]/a))
|
if about.xpath_node(%q(//div[contains(@class, "channel-empty-message")]))
|
||||||
about = client.get("/user/#{ucid}/about?disable_polymer=1&gl=US&hl=en")
|
error_message = "This channel does not exist."
|
||||||
about = XML.parse_html(about.body)
|
|
||||||
|
raise error_message
|
||||||
end
|
end
|
||||||
|
|
||||||
if about.xpath_node(%q(//span[contains(@class,"qualified-channel-title-text")]/a)).try &.content.empty?
|
if about.xpath_node(%q(//span[contains(@class,"qualified-channel-title-text")]/a)).try &.content.empty?
|
||||||
|
|
Loading…
Reference in a new issue