diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-08-08 13:20:21 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-08-08 13:20:21 -0500 |
| commit | 6b2774c081f0549ccf8d25a38cde4eebf5404356 (patch) | |
| tree | 7229ce8d067a8c6b53f0cc5eaa9d279ea48b0f90 | |
| parent | 3ebe9139b7b418b8667cee3cb67b33be80655167 (diff) | |
| download | invidious-6b2774c081f0549ccf8d25a38cde4eebf5404356.tar.gz invidious-6b2774c081f0549ccf8d25a38cde4eebf5404356.tar.bz2 invidious-6b2774c081f0549ccf8d25a38cde4eebf5404356.zip | |
Add fix for unavailable channels
| -rw-r--r-- | src/invidious.cr | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index c7081d94..f1e8c691 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -1579,7 +1579,12 @@ get "/channel/:ucid" do |env| end document = XML.parse_html(json["content_html"].as_s) - author = document.xpath_node(%q(//div[@class="pl-video-owner"]/a)).not_nil!.content + anchor = document.xpath_node(%q(//div[@class="pl-video-owner"]/a)) + if !anchor + error_message = "This channel is not available" + next templated "error" + end + author = anchor.content videos = [] of ChannelVideo document.xpath_nodes(%q(//a[contains(@class,"pl-video-title-link")])).each do |node| |
