From ba976d6f9948c03006f988d1406b4179a7f92ed5 Mon Sep 17 00:00:00 2001 From: Urgau Date: Tue, 12 Jun 2018 13:36:46 +0200 Subject: [PATCH 1/2] [vidzi.tv] Fix #16678 Yeah, I know it's a bad fix but there's no choice because we can't execute the js and it wouldn't make any sense because we don't need it. --- youtube_dl/extractor/vidzi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/vidzi.py b/youtube_dl/extractor/vidzi.py index 9026e778c..a3ede8627 100644 --- a/youtube_dl/extractor/vidzi.py +++ b/youtube_dl/extractor/vidzi.py @@ -53,7 +53,7 @@ class VidziIE(InfoExtractor): jwplayer_data = self._parse_json( self._search_regex( r'setup\(([^)]+)\)', code, 'jwplayer data', - default=NO_DEFAULT if num == len(codes) else '{}'), + default=NO_DEFAULT if num == len(codes) else '{}').replace('+ window[\'vastRef\']', ''), video_id, transform_source=js_to_json) if jwplayer_data: break From ee98dc7ee97e55341a5d1615e69753bc348ef983 Mon Sep 17 00:00:00 2001 From: Sergey M Date: Sat, 16 Jun 2018 05:08:01 +0700 Subject: [PATCH 2/2] Update vidzi.py --- youtube_dl/extractor/vidzi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/vidzi.py b/youtube_dl/extractor/vidzi.py index a3ede8627..d70283479 100644 --- a/youtube_dl/extractor/vidzi.py +++ b/youtube_dl/extractor/vidzi.py @@ -53,8 +53,9 @@ class VidziIE(InfoExtractor): jwplayer_data = self._parse_json( self._search_regex( r'setup\(([^)]+)\)', code, 'jwplayer data', - default=NO_DEFAULT if num == len(codes) else '{}').replace('+ window[\'vastRef\']', ''), - video_id, transform_source=js_to_json) + default=NO_DEFAULT if num == len(codes) else '{}'), + video_id, transform_source=lambda s: js_to_json( + re.sub(r'\s*\+\s*window\[.+?\]', '', s))) if jwplayer_data: break