Check parts properly inside a format key

This commit is contained in:
Mark Lee 2014-04-15 12:39:00 -07:00
parent 7d33af60cd
commit d7b31b5b35

View File

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