mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 11:34:18 +00:00
Don't crash if no videos are returned by a search
This commit is contained in:
parent
3138250c7f
commit
20e0a86fb7
1 changed files with 3 additions and 0 deletions
|
@ -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"]]
|
||||
|
|
Loading…
Reference in a new issue