downloader: fix NoneType error
Sometimes YoutubeDL()'s extract_info can't retrieve a video's metadata (e.g. if the video has been privated or age-restricted) and ends up making an empty or incomplete entry on the playlist's info_dict. Catching this TypeError exception fixes workers from crashing and burning when they encounter these empty or incomplete entries.
This commit is contained in:
parent
950b695f47
commit
b98fba1508
1 changed files with 6 additions and 6 deletions
|
|
@ -87,10 +87,10 @@ def do_download(
|
|||
except Empty:
|
||||
break
|
||||
|
||||
if entry["id"] is None:
|
||||
continue
|
||||
else:
|
||||
try:
|
||||
id_dir = entry["id"]
|
||||
except TypeError:
|
||||
continue
|
||||
|
||||
try:
|
||||
os.mkdir(id_dir)
|
||||
|
|
@ -194,10 +194,10 @@ def check_dl(in_q: Queue, out_q: Queue):
|
|||
except Empty:
|
||||
break
|
||||
|
||||
if entry["id"] is None:
|
||||
continue
|
||||
else:
|
||||
try:
|
||||
id_dir = entry["id"]
|
||||
except TypeError:
|
||||
continue
|
||||
|
||||
if os.path.isdir(id_dir):
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue