yt-dlp: [twitter] Failed to parse JSON error with cookies

Checklist

  • I’m reporting that yt-dlp is broken on a supported site
  • I’ve verified that I have updated yt-dlp to nightly or master (update instructions)
  • I’ve checked that all provided URLs are playable in a browser with the same IP and same login details
  • I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
  • I’ve searched known issues, the FAQ, and the bugtracker for similar issues including closed ones. DO NOT post duplicates
  • I’ve read about sharing account credentials and I’m willing to share it if required

Region

FR

Provide a description that is worded well enough to be understood

Since 6PM CET i get a lot of “Failed to parse JSON errors” while trying to download tweets with “–cookies” public videos are still working.

Provide verbose output that clearly demonstrates the problem

  • Run your yt-dlp command with -vU flag added (yt-dlp -vU <your command line>)
  • If using API, add 'verbose': True to YoutubeDL params instead
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

./yt-dlp_linux -f b -v "https://x.com/pamerkntol/status/1912464411564155136" --cookies ../cookies/x/[xyz].txt
[debug] Command-line config: ['-f', 'b', '-v', 'https://x.com/pamerkntol/status/1912464411564155136', '--cookies', '../cookies/x/[xyz].txt']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2025.03.31 from yt-dlp/yt-dlp (linux_exe)
[debug] Python 3.11.11 (CPython x86_64 64bit) - Linux-4.19.0-16-amd64-x86_64-with (OpenSSL 3.1.8 11 Feb 2025)
[debug] exe versions: ffmpeg 4.1.11-0, ffprobe 4.1.11-0, phantomjs 2.1.1
[debug] Optional libraries: Cryptodome-3.22.0, brotli-1.1.0, certifi-2025.01.31, curl_cffi-0.10.0, mutagen-1.47.0, requests-2.32.3, secretstorage-3.3.3, sqlite3-3.44.2, urllib3-2.3.0, websockets-15.0.1
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi
[debug] Plugin directories: none
[debug] Loaded 1850 extractors
[twitter] Extracting URL: https://x.com/pamerkntol/status/1912464411564155136
[twitter] 1912464411564155136: Downloading GraphQL JSON
ERROR: [twitter] 1912464411564155136: 1912464411564155136: Failed to parse JSON (caused by JSONDecodeError("Expecting value in '': line 1 column 1 (char 0)")); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "yt_dlp/extractor/common.py", line 748, in extract
  File "yt_dlp/extractor/twitter.py", line 1398, in _real_extract
  File "yt_dlp/extractor/twitter.py", line 1376, in _extract_status
  File "yt_dlp/extractor/twitter.py", line 333, in _call_graphql_api
  File "yt_dlp/extractor/twitter.py", line 314, in _call_api
  File "yt_dlp/extractor/common.py", line 1145, in download_content
  File "yt_dlp/extractor/common.py", line 1110, in download_handle
  File "yt_dlp/extractor/common.py", line 1098, in parse
  File "yt_dlp/extractor/common.py", line 1085, in _parse_json
  File "yt_dlp/extractor/common.py", line 1068, in __print_error

  File "yt_dlp/utils/_utils.py", line 567, in decode
  File "json/decoder.py", line 337, in decode
  File "json/decoder.py", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "yt_dlp/extractor/common.py", line 1082, in _parse_json
  File "json/__init__.py", line 359, in loads
  File "yt_dlp/utils/_utils.py", line 575, in decode
json.decoder.JSONDecodeError: Expecting value in '': line 1 column 1 (char 0)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 17 (4 by maintainers)

Commits related to this issue

Most upvoted comments

There seems to be an issue with the site as a whole.

Most of my 3rd party applications do not seem to work, especially the ones to download media

Worked like a charm, until a few hours. X has recently updated their notifications graphql response, guess they did it now with videos too. I will dig deeper in it now.

Do some of you want to give #13024 a try

I came a step closer, it looks like the “x-client-transaction-id” header is required now. But i haven’t found out how to obtain it now.

I found this repo but it’s python again: https://github.com/iSarabjitDhiman/XClientTransaction

There seems to be an issue with the site as a whole.

Most of my 3rd party applications do not seem to work, especially the ones to download media

Do some of you want to give #13024 a try

I’m a few days late to this, but I upgraded to HEAD-8cb0802 and it works for me without needing to change cookies or anything else.

Thank you so much!

if you want an immediate but temporary solution, just pass this header: x-client-transaction-id: H/HJB3naILIqzncBBvY50XFL36IYeol67HU4ZlUe8wYvWdn9q7KJf7k2UBKOMwliRmCnohzCodsUCuvWOl9t0Z/wVY3QHA