From 20e0a86fb7e6c7d14119b1fd979b3fe6b3db6d82 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 10 Sep 2019 13:53:07 +0200 Subject: [PATCH] Don't crash if no videos are returned by a search --- royalnet/audio/ytdlinfo.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/royalnet/audio/ytdlinfo.py b/royalnet/audio/ytdlinfo.py index 57dcd3b2..739b086a 100644 --- a/royalnet/audio/ytdlinfo.py +++ b/royalnet/audio/ytdlinfo.py @@ -88,6 +88,9 @@ class YtdlInfo: # So many redundant options! ytdl = youtube_dl.YoutubeDL({**cls._default_ytdl_args, **ytdl_args}) first_info = ytdl.extract_info(url=url, download=False) + # No video was found + if first_info is None: + return [] # If it is a playlist, create multiple videos! if "entries" in first_info: return [YtdlInfo(second_info) for second_info in first_info["entries"]]