summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-09-23 12:32:32 -0500
committerOmar Roth <omarroth@hotmail.com>2018-09-23 12:32:32 -0500
commita5e8f87a26cdb18cd3ee3eead9e37a420e007d46 (patch)
tree43b8065f264e2a141f49eebba56b233dbd24c16f
parent1d9c6f63e1f423c8a4421acbbc5a5541f88b572d (diff)
downloadinvidious-a5e8f87a26cdb18cd3ee3eead9e37a420e007d46.tar.gz
invidious-a5e8f87a26cdb18cd3ee3eead9e37a420e007d46.tar.bz2
invidious-a5e8f87a26cdb18cd3ee3eead9e37a420e007d46.zip
Add error for non-existent playlists
-rw-r--r--src/invidious/playlists.cr7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr
index e14a7709..d78d68bf 100644
--- a/src/invidious/playlists.cr
+++ b/src/invidious/playlists.cr
@@ -153,8 +153,11 @@ def fetch_playlist(plid)
, "")
document = XML.parse_html(body)
- title = document.xpath_node(%q(//h1[@class="pl-header-title"])).not_nil!.content
- title = title.strip(" \n")
+ title = document.xpath_node(%q(//h1[@class="pl-header-title"]))
+ if !title
+ raise "Playlist does not exist."
+ end
+ title = title.content.strip(" \n")
description_html = document.xpath_node(%q(//span[@class="pl-header-description-text"]/div/div[1]))
description_html, description = html_to_content(description_html)