Repository: youtube-dl
Issue: [RTP] Failed to parse JSON
Labels: pending-fixes,duplicate

Hello,

I was trying to download a video with it's captions (to learn Portuguese) but that failed. Please see below output (with --verbose). 
Portuguese is spoken very fast, and even with the provided captions, it is still not easy to understand the whole video content, so ...  I thought I'd download and play the video in a player that provides reduced speed.

Any chance to fix this? Thanks a lot! 

$ youtube-dl --all-subs --verbose https://www.rtp.pt/play/p8322/nada-sera-como-dante
[debug] System config: ['--prefer-free-formats']
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--all-subs', '--verbose', 'https://www.rtp.pt/play/p8322/nada-sera-como-dante']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.06.06
[debug] Python version 3.10.1 (CPython) - Linux-5.15.14-200.fc35.x86_64-x86_64-with-glibc2.34
[debug] exe versions: ffmpeg 4.4.1, ffprobe 4.4.1
[debug] Proxy map: {}
[RTP] nada-sera-como-dante: Downloading webpage
ERROR: nada-sera-como-dante: Failed to parse JSON  (caused by JSONDecodeError("Expecting ',' delimiter: line 2 column 36 (char 37)")); 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 "/usr/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 906, in _parse_json
    return json.loads(json_string)
  File "/usr/lib64/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.10/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 2 column 36 (char 37)
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 906, in _parse_json
    return json.loads(json_string)
  File "/usr/lib64/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.10/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 2 column 36 (char 37)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 814, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 835, in __extract_info
    ie_result = ie.extract(url)
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 534, in extract
    ie_result = self._real_extract(url)
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/rtp.py", line 35, in _real_extract
    config = self._parse_json(self._search_regex(
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 910, in _parse_json
    raise ExtractorError(errmsg, cause=ve)
youtube_dl.utils.ExtractorError: nada-sera-como-dante: Failed to parse JSON  (caused by JSONDecodeError("Expecting ',' delimiter: line 2 column 36 (char 37)")); 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.