projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
177fed4
)
[YouTubeDL] Throw an early error if the info_dict result is invalid
author
Philipp Hagemeister
<phihag@phihag.de>
Thu, 3 Apr 2014 12:36:40 +0000
(14:36 +0200)
committer
Philipp Hagemeister
<phihag@phihag.de>
Thu, 3 Apr 2014 12:38:16 +0000
(14:38 +0200)
youtube_dl/YoutubeDL.py
patch
|
blob
|
history
diff --git
a/youtube_dl/YoutubeDL.py
b/youtube_dl/YoutubeDL.py
index 84acaa5dc64fa82e7bd8934871c40c1fda12623c..430773edda28e5847ae7f702e40655c692c402a4 100644
(file)
--- 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'
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
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):
# 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:
if format.get('format_id') is None:
format['format_id'] = compat_str(i)
if format.get('format') is None: