Repository: ytdl-org/youtube-dl

Issue:
vidzi.tv doesn't work
$youtube-dl --version
2018.06.04

$youtube-dl and http://vidzi.tv links doesn't work

for example:
$youtube-dl http://vidzi.tv/n83vo2mlnpgb

Failed to parse JSON  (caused by ValueError("Expecting ',' delimiter: line 12 column 175 (char 771)",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

$youtube-dl --verbose http://vidzi.tv/n83vo2mlnpgb

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--verbose', u'http://vidzi.tv/n83vo2mlnpgb']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.06.04
[debug] Python version 2.7.10 (CPython) - Darwin-17.5.0-x86_64-i386-64bit
[debug] exe versions: avconv 12.3, avprobe 12.3, ffmpeg 3.4.2, ffprobe 3.4.2
[debug] Proxy map: {}
[Vidzi] n83vo2mlnpgb: Downloading webpage
ERROR: n83vo2mlnpgb: Failed to parse JSON  (caused by ValueError("Expecting ',' delimiter: line 12 column 175 (char 791)",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/youtube_dl/extractor/common.py", line 774, in _parse_json
    return json.loads(json_string)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Expecting ',' delimiter: line 12 column 175 (char 791)
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/youtube_dl/YoutubeDL.py", line 792, in extract_info
    ie_result = ie.extract(url)
  File "/Library/Python/2.7/site-packages/youtube_dl/extractor/common.py", line 500, in extract
    ie_result = self._real_extract(url)
  File "/Library/Python/2.7/site-packages/youtube_dl/extractor/vidzi.py", line 57, in _real_extract
    video_id, transform_source=js_to_json)
  File "/Library/Python/2.7/site-packages/youtube_dl/extractor/common.py", line 778, in _parse_json
    raise ExtractorError(errmsg, cause=ve)
ExtractorError: n83vo2mlnpgb: Failed to parse JSON  (caused by ValueError("Expecting ',' delimiter: line 12 column 175 (char 791)",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.




Discussion:

Resolving patch:
diff --git a/youtube_dl/extractor/vidzi.py b/youtube_dl/extractor/vidzi.py
--- a/youtube_dl/extractor/vidzi.py
+++ b/youtube_dl/extractor/vidzi.py
@@ -54,7 +54,8 @@ def _real_extract(self, url):
                 self._search_regex(
                     r'setup\(([^)]+)\)', code, 'jwplayer data',
                     default=NO_DEFAULT if num == len(codes) else '{}'),
-                video_id, transform_source=js_to_json)
+                video_id, transform_source=lambda s: js_to_json(
+                    re.sub(r'\s*\+\s*window\[.+?\]', '', s)))
             if jwplayer_data:
                 break
 


Test patch: