diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-09-28 09:54:45 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-09-28 09:54:45 -0500 |
| commit | 29a6291957fc5e383c5f4f13a08c61b58e111617 (patch) | |
| tree | baf4472db24cc0d17adca923b83a311eda25390f | |
| parent | 25ba5bda62fcc9015a76cb586904250886d45e95 (diff) | |
| download | invidious-29a6291957fc5e383c5f4f13a08c61b58e111617.tar.gz invidious-29a6291957fc5e383c5f4f13a08c61b58e111617.tar.bz2 invidious-29a6291957fc5e383c5f4f13a08c61b58e111617.zip | |
Show info instead of empty playlist when possible
| -rw-r--r-- | src/invidious.cr | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 8d21a2c4..dc61c105 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -401,12 +401,17 @@ get "/playlist" do |env| begin playlist = fetch_playlist(plid) - videos = fetch_playlist_videos(plid, page, playlist.video_count) rescue ex error_message = ex.message next templated "error" end + begin + videos = fetch_playlist_videos(plid, page, playlist.video_count) + rescue ex + videos = [] of PlaylistVideo + end + templated "playlist" end @@ -2872,12 +2877,17 @@ get "/api/v1/playlists/:plid" do |env| begin playlist = fetch_playlist(plid) - videos = fetch_playlist_videos(plid, page, playlist.video_count) rescue ex error_message = {"error" => "Playlist is empty"}.to_json halt env, status_code: 404, response: error_message end + begin + videos = fetch_playlist_videos(plid, page, playlist.video_count) + rescue ex + videos = [] of PlaylistVideo + end + response = JSON.build do |json| json.object do json.field "title", playlist.title |
