ytdl-org/youtube-dl · error · ExtractorError
%s: Failed to parse JSON
Error message
%s: Failed to parse JSON
What it means
Error "%s: Failed to parse JSON " thrown in ytdl-org/youtube-dl.
Source
Thrown at youtube_dl/extractor/common.py:958
See _download_webpage docstring for arguments specification.
"""
res = self._download_json_handle(
url_or_request, video_id, note=note, errnote=errnote,
transform_source=transform_source, fatal=fatal, encoding=encoding,
data=data, headers=headers, query=query,
expected_status=expected_status)
return res if res is False else res[0]
def _parse_json(self, json_string, video_id, transform_source=None, fatal=True):
if transform_source:
json_string = transform_source(json_string)
try:
return json.loads(json_string)
except ValueError as ve:
errmsg = '%s: Failed to parse JSON ' % video_id
if fatal:
raise ExtractorError(errmsg, cause=ve)
else:
self.report_warning(errmsg + str(ve))
def __ie_msg(self, *msg):
return '[{0}] {1}'.format(self.IE_NAME, ''.join(msg))
# msg, video_id=None, *args, only_once=False, **kwargs
def report_warning(self, msg, *args, **kwargs):
if len(args) > 0:
video_id = args[0]
args = args[1:]
else:
video_id = kwargs.pop('video_id', None)
idstr = '' if video_id is None else '%s: ' % video_id
self._downloader.report_warning(
self.__ie_msg(idstr, msg), *args, **kwargs)
def to_screen(self, msg):View on GitHub (pinned to 956b8c5855)
Solutions
- Verify the server returned valid JSON; retry or update youtube-dl if the site changed its API.
When it happens
Trigger: Thrown at youtube_dl/extractor/common.py:958 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14).
Data as JSON: /api/errors/6b7f8da740b86fd5.
Report an issue: GitHub.