yt-dlp: [twitch] ERROR: 'NoneType' object is not subscriptable
DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE
- I understand that I will be blocked if I intentionally remove or skip any mandatory* field
Checklist
- I’m reporting that yt-dlp is broken on a supported site
- I’ve verified that I’m running yt-dlp version 2023.03.04 (update instructions) or later (specify commit)
- 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 and the bugtracker for similar issues including closed ones. DO NOT post duplicates
- I’ve read the guidelines for opening an issue
- I’ve read about sharing account credentials and I’m willing to share it if required
Region
United States
Provide a description that is worded well enough to be understood
What I did:
Tried to download a Twitch stream like this:
yt-dlp 'https://twitch.tv/gamesdonequick'
What I expected to happen: It starts downloading
What happened instead:
ERROR: 'NoneType' object is not subscriptable
- I was successfully using
yt-dlp
with Twitch earlier today. - The issue is not limited to my IP address AFAICT
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
toYoutubeDL
params instead - Copy the WHOLE output (starting with
[debug] Command-line config
) and insert it below
Complete Verbose Output
[debug] Command-line config: ['-vU', 'https://twitch.tv/gamesdonequick']
[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@2023.03.04 [392389b7d]
[debug] Lazy loading extractors is disabled
[debug] Python 3.11.3 (CPython x86_64 64bit) - Linux-6.2.13-arch1-1-x86_64-with-glibc2.37 (OpenSSL 3.0.9 30 May 2023, glibc 2.37)
[debug] exe versions: ffmpeg 6.0 (setts), ffprobe 6.0, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.18.0, brotlicffi-1.0.9.2, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[debug] Proxy map: {}
[debug] Loaded 1842 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.03.04, Current version: stable@2023.03.04
yt-dlp is up to date (stable@2023.03.04)
[twitch:stream] Extracting URL: https://twitch.tv/gamesdonequick
[twitch:stream] gamesdonequick: Downloading stream GraphQL
[twitch:stream] gamesdonequick: Downloading stream access token GraphQL
ERROR: 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1552, in wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1628, in __extract_info
ie_result = ie.extract(url)
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/yt_dlp/extractor/common.py", line 698, in extract
ie_result = self._real_extract(url)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/yt_dlp/extractor/twitch.py", line 1025, in _real_extract
token = access_token['value']
~~~~~~~~~~~~^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 19
- Comments: 20 (2 by maintainers)
Commits related to this issue
- [extractor/twitch] Update `_CLIENT_ID` and add extractor-arg (#7200) Closes #7058, Closes #7183 Authored by: bashonly — committed to yt-dlp/yt-dlp by bashonly a year ago
https://github.com/streamlink/streamlink/issues/5370#issuecomment-1572576728 https://github.com/m4eba/twitch-dump/commit/2006b88ca8fc57e343357dd3dc415677fa502860
Seems that replacing the ID here https://github.com/yt-dlp/yt-dlp/blob/c35448b7b14113b35c4415dbfbf488c4731f006f/yt_dlp/extractor/twitch.py#L44 with
ue6666qo983tsx6so1t0vnawi233wa
, workshttps://github.com/streamlink/streamlink/issues/5370#issuecomment-1572804535 https://github.com/streamlink/streamlink/issues/5370#issuecomment-1572816289 Looks like it again works with the old ID (
kimne78kx3ncx6brgo4mv6wki5h1ko
)Any idea how those of us using the pip version of yt_dlp might be able to do this fix? I have an automation script for twitch that seems to be broken now because of this API change. I would add my console output, but I don’t want to flood the thread.
Related: #7058
It seems that Twitch is now requiring the “integrity” challenge for livestream GraphQL requests as well. The JSON response that yt-dlp gets:
See linked issue for more info
Possibly related: Twitch is now also blocking Firefox from watching livestreams if
privacy.resistFingerprinting
is enabled. Seems both site changes occurred around the same time. (Previously, Twitch was already blocking Firefox RFP from login, and the bugzilla report about that contains some troubling info about what we are up against)@trit34 as noted in the streamlink issue, it was probably one of the first tests before going permanent. Twitch probably wants to save on BOT bandwidth since no advertiser will trust their metrics anyway (the only metrics advertisers can trust is the correlation of the actual sales with an advertisement campaign).
Found another _CLIENT_ID that works (tested the same way as above):
kd1unb4b3q4t58fwlpcbzcbnm76a8fp
Courtesy of the good folks at https://github.com/crackededed/Xtra
Was about to post this, can confirm it is working for the time being. Got the file path i needed by running
yt-dlp --verbose "https://twitch.tv/streamer_name"
, the output will have a stacktrace with thetwitch.py
filepath at the end.Okay, I found a fix for us pip users. It’s really simple. Run
py -m pip show yt_dlp
and you should get and output that looks kinda like this:Go to that location and modify line 44 in
yt-dlp/yt_dlp/extractor/twitch.py
as @Gregaras said, changing_CLIENT_ID
in theTwitchBaseIE()
function to'ue6666qo983tsx6so1t0vnawi233wa'
. Works for me now, though who can say for how long.No, it does not work currently.