From 2485f892015e34ec2252b0b68a3b957ed92214db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20L=C3=B8vdal?= Date: Tue, 12 Jun 2018 20:19:51 +0200 Subject: [PATCH] [vidzi] Introduce intermediate json_data variable It makes it easier to debug in case of problems and it also makes the code much easier to read since the three distinct things done are now explicit separated as three statements. --- youtube_dl/extractor/vidzi.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/youtube_dl/extractor/vidzi.py b/youtube_dl/extractor/vidzi.py index d70283479..9092c030d 100644 --- a/youtube_dl/extractor/vidzi.py +++ b/youtube_dl/extractor/vidzi.py @@ -50,12 +50,12 @@ class VidziIE(InfoExtractor): decode_packed_codes(mobj.group(0)).replace('\\\'', '\'') for mobj in re.finditer(PACKED_CODES_RE, webpage)]) for num, code in enumerate(codes, 1): - jwplayer_data = self._parse_json( - self._search_regex( - r'setup\(([^)]+)\)', code, 'jwplayer data', - default=NO_DEFAULT if num == len(codes) else '{}'), - video_id, transform_source=lambda s: js_to_json( - re.sub(r'\s*\+\s*window\[.+?\]', '', s))) + json_data = self._search_regex( + r'setup\(([^)]+)\)', code, 'jwplayer data', + default=NO_DEFAULT if num == len(codes) else '{}') + json_data = re.sub(r'\s*\+\s*window\[.+?\]', '', json_data) + # print 'json_data: {0}'.format(json_data) + jwplayer_data = self._parse_json(json_data, video_id, transform_source=js_to_json) if jwplayer_data: break