mirror of
				https://github.com/iv-org/invidious.git
				synced 2025-10-30 20:22:00 +00:00 
			
		
		
		
	Show info instead of empty playlist when possible
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Omar Roth
					Omar Roth