From d7b31b5b35d04dc33e6ff00ccbf083724f6eefc6 Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Tue, 15 Apr 2014 12:39:00 -0700 Subject: [PATCH] Check parts properly inside a format key --- youtube_dl/YoutubeDL.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 95b7a9f31..b939314ea 100644 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -739,8 +739,13 @@ class YoutubeDL(object): # We check that all the formats have the format and format_id fields for i, format in enumerate(formats): - if 'url' not in format: - raise ExtractorError('Missing "url" key in result (index %d)' % i) + if 'parts' in format: + 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: format['format_id'] = compat_str(i)