diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-07-29 11:31:00 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-07-29 11:31:00 -0500 |
| commit | 503c47c8bf9da16bfb82b301610ff7dd88c65faf (patch) | |
| tree | 1c26415c9a8a001d44255adb2a5df7fdce55ea9f /src | |
| parent | 2b911aabc4ec656eaea88eb60a8ad9f65f3ae89d (diff) | |
| download | invidious-503c47c8bf9da16bfb82b301610ff7dd88c65faf.tar.gz invidious-503c47c8bf9da16bfb82b301610ff7dd88c65faf.tar.bz2 invidious-503c47c8bf9da16bfb82b301610ff7dd88c65faf.zip | |
Fix 500 on channel page when video list is empty
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious.cr | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 1195417f..11c502e5 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -2222,6 +2222,16 @@ get "/channel/:ucid" do |env| response = client.get(url) json = JSON.parse(response.body) + if json["content_html"].as_s.strip(" \n").empty? + rss = client.get("/feeds/videos.xml?channel_id=#{ucid}").body + rss = XML.parse_html(rss) + author = rss.xpath_node("//feed/author/name").not_nil!.content + + videos = [] of ChannelVideo + + next templated "channel" + end + document = XML.parse_html(json["content_html"].as_s) author = document.xpath_node(%q(//div[@class="pl-video-owner"]/a)).not_nil!.content |
