avoid AttributeError in json_output.py

This commit is contained in:
wwqgtxx 2017-07-25 21:49:23 +08:00 committed by GitHub
parent 4891ae1783
commit e614cda733

View File

@ -17,9 +17,9 @@ def output(video_extractor, pretty_print=True):
except AttributeError:
pass
extra = {}
if ve.referer is not None:
if getattr(ve, 'referer', None) is not None:
extra["referer"] = ve.referer
if ve.ua is not None:
if getattr(ve, 'ua', None) is not None:
extra["ua"] = ve.ua
if extra:
out["extra"] = extra