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:
Andrea Rogers 2021-10-16 19:11:40 -04:00
commit b98fba1508

View file

@ -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: