From 4891ae1783b5916727180a4958eba46e477195cc Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Mon, 10 Jul 2017 01:08:48 +0800 Subject: [PATCH] output refer and ua message in json --- src/you_get/json_output.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/you_get/json_output.py b/src/you_get/json_output.py index 0f0f48ec..2c9950ae 100644 --- a/src/you_get/json_output.py +++ b/src/you_get/json_output.py @@ -16,6 +16,13 @@ def output(video_extractor, pretty_print=True): out['audiolang'] = ve.audiolang except AttributeError: pass + extra = {} + if ve.referer is not None: + extra["referer"] = ve.referer + if ve.ua is not None: + extra["ua"] = ve.ua + if extra: + out["extra"] = extra if pretty_print: print(json.dumps(out, indent=4, sort_keys=True, ensure_ascii=False)) else: