summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2014-04-03 14:36:40 +0200
committerPhilipp Hagemeister <[email protected]>2014-04-03 14:38:16 +0200
commitbec1fad2234a9b6d1fac6a1a430af2b828fb8060 (patch)
treeeb7ff19d2f35353eb93128416f29e78f58910242
parent177fed41bcdd7f583b4a0ba66f87ce308c13c4fa (diff)
downloadyoutube-dl-bec1fad2234a9b6d1fac6a1a430af2b828fb8060.tar.gz
youtube-dl-bec1fad2234a9b6d1fac6a1a430af2b828fb8060.zip
[YouTubeDL] Throw an early error if the info_dict result is invalid
-rw-r--r--youtube_dl/YoutubeDL.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 84acaa5dc..430773edd 100644
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -702,6 +702,11 @@ class YoutubeDL(object):
def process_video_result(self, info_dict, download=True):
assert info_dict.get('_type', 'video') == 'video'
+ if 'id' not in info_dict:
+ raise ExtractorError('Missing "id" field in extractor result')
+ if 'title' not in info_dict:
+ raise ExtractorError('Missing "title" field in extractor result')
+
if 'playlist' not in info_dict:
# It isn't part of a playlist
info_dict['playlist'] = None
@@ -733,6 +738,9 @@ 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 format.get('format_id') is None:
format['format_id'] = compat_str(i)
if format.get('format') is None: