[utils] Improve and test js_to_json
This commit is contained in:
parent
410f3e73ab
commit
e7b6d12254
3 changed files with 38 additions and 25 deletions
|
@ -334,7 +334,11 @@ class InfoExtractor(object):
|
|||
try:
|
||||
return json.loads(json_string)
|
||||
except ValueError as ve:
|
||||
raise ExtractorError('Failed to download JSON', cause=ve)
|
||||
errmsg = '%s: Failed to parse JSON ' % video_id
|
||||
if fatal:
|
||||
raise ExtractorError(errmsg, cause=ve)
|
||||
else:
|
||||
self.report_warning(errmsg + str(ve))
|
||||
|
||||
def report_warning(self, msg, video_id=None):
|
||||
idstr = '' if video_id is None else '%s: ' % video_id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue