Check parts properly inside a format key
This commit is contained in:
parent
7d33af60cd
commit
d7b31b5b35
@ -739,8 +739,13 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
# We check that all the formats have the format and format_id fields
|
# We check that all the formats have the format and format_id fields
|
||||||
for i, format in enumerate(formats):
|
for i, format in enumerate(formats):
|
||||||
if 'url' not in format:
|
if 'parts' in format:
|
||||||
raise ExtractorError('Missing "url" key in result (index %d)' % i)
|
for j, part in enumerate(format['parts']):
|
||||||
|
if 'url' not in part:
|
||||||
|
raise ExtractorError('Missing "url" key in result (index %d, part %d)' % (i, j))
|
||||||
|
else:
|
||||||
|
if 'url' not in format:
|
||||||
|
raise ExtractorError('Missing "url" key in result (index %d)' % i)
|
||||||
|
|
||||||
if format.get('format_id') is None:
|
if format.get('format_id') is None:
|
||||||
format['format_id'] = compat_str(i)
|
format['format_id'] = compat_str(i)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user