-
-
Notifications
You must be signed in to change notification settings - Fork 156
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Basic information
- Program version: 0.2.8
- Python version: 3.12.3
- Operating system: Ubuntu
Describe the bug
As of a few hours ago (definitely fewer than 24), chat_downloader ceased operating entirely on Twitch, for either live streams or VODs.
Command/Code used
If running from the command line, provide the following:
- The command used (including the verbose tag,
-v):
$ chat_downloader -v https://www.twitch.tv/dashducks
- Output from the above command:
[DEBUG] Python version: 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0]
[DEBUG] Program version: 0.2.8
[DEBUG] Initialisation parameters: {'headers': None, 'cookies': None, 'proxy': None}
[DEBUG] Created TwitchChatDownloader session.
[INFO] Site: twitch.tv
[DEBUG] Program parameters: {'url': 'https://www.twitch.tv/dashducks', 'start_time': None, 'end_time': None, 'max_attempts': 15, 'retry_timeout': None, 'interruptible_retry': True, 'timeout': None, 'inactivity_timeout': None, 'max_messages': None, 'message_groups': ['messages'], 'message_types': None, 'output': None, 'overwrite': True, 'sort_keys': True, 'indent': 4, 'format': 'twitch', 'format_file': None, 'chat_type': 'live', 'ignore': None, 'message_receive_timeout': 0.1, 'buffer_size': 4096}
[DEBUG] Starting new HTTPS connection (1): gql.twitch.tv:443
[DEBUG] https://gql.twitch.tv:443 "POST /gql HTTP/1.1" 200 165
[DEBUG] Session closed.
Traceback (most recent call last):
File "/home/crj/venv-testing/bin/chat_downloader", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/crj/venv-testing/lib/python3.12/site-packages/chat_downloader/cli.py", line 194, in main
run(**args.__dict__)
File "/home/crj/venv-testing/lib/python3.12/site-packages/chat_downloader/chat_downloader.py", line 351, in run
chat = downloader.get_chat(**chat_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/crj/venv-testing/lib/python3.12/site-packages/chat_downloader/chat_downloader.py", line 224, in get_chat
chat = get_chat(match, params)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/crj/venv-testing/lib/python3.12/site-packages/chat_downloader/sites/twitch.py", line 1646, in _get_chat_by_stream_id
return self.get_chat_by_stream_id(match.group('id'), params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/crj/venv-testing/lib/python3.12/site-packages/chat_downloader/sites/twitch.py", line 1659, in get_chat_by_stream_id
stream_info = self._download_gql(query)[0]['data']['user']
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'data'
Otherwise, if using the python module, provide the following:
I'm not including an example because the problem is reproducible via the command line, but I initially observed it via the Python API (with the same exception at the same point in the code).
Expected behavior
I expected the program to retrieve chat messages.
Screenshots
n/a
Additional context/information
I believe this is because Twitch has replaced all of their GQL persistedQuery hashes; yt-dlp and streamlink are also affected.
This means that _OPERATION_HASHES at twitch.py:842 needs updating. I would fix it myself, but I can't see how to determine the replacements.
sebastientromp and goproslowyonio-p
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Projects
Milestone
Relationships
Development
Select code repository
Activity
babupipi commentedon Nov 11, 2025
twitch.py
Line 856
# 'ComscoreStreamingQuery': 'e1edae8122517d013405f237ffcc124515dc6ded82480a88daef69c83b53ac01',
Do this
'ComscoreStreamingQuery': 'e1edae8122517d013405f237ffcc124515dc6ded82480a88daef69c83b53ac01',
and
Line 1652
Do this
gadi-playstream-gg commentedon Nov 11, 2025
having the same issue.
uwu-crj commentedon Nov 11, 2025
Thanks โ that seems to fix acquisition from a live stream, but the problem remains for a VOD.
Acting on raw intuition based on the change you suggested for
get_chat_by_stream_idI tried amendingget_chat_by_vod_idto say:โฆbut that didn't work ยญยญโ when I instrumented it to print the GQL response, it read:
[ { "errors": [ { "message": "PersistedQueryNotFound" } ], "extensions": { "durationMilliseconds": 2, "operationName": "VideoMetadata", "requestID": "01K9S9E7XR72CQVP8SRYBJ647D" } }, { "data": {}, "extensions": { "durationMilliseconds": 2, "operationName": "ComscoreStreamingQuery", "requestID": "01K9S9E7XR72CQVP8SRYBJ647D" } }sebastientromp commentedon Nov 12, 2025
Same issue here. Did anything change in the Twitch API?
I don't see anything in the changelog at https://dev.twitch.tv/docs/change-log/
nio-p commentedon Nov 12, 2025
@uwu-crj @sebastientromp
I changed the hash values โโof
StreamMetadataandVideoMetadataas follows and it worked fine.The relevant code is around line 842.
uwu-crj commentedon Nov 12, 2025
@nio-p
Excellent. Thanks!
That gets downloading chat for VODs working, butโฆ did you test it on a live stream? I find it doesn't help there.
I think everything may work if I mash together your solution and @babupipi 's, though. ๐ค
uwu-crj commentedon Nov 12, 2025
Update: Yes. A frankenpatch works for both live streams and VODs. (I've not tested it on clipsโฆ)
gadi-playstream-gg commentedon Nov 12, 2025
should I expect a new version soon?
Edwa42 commentedon Nov 12, 2025
Personally I won't count on that, the the last update this lib received was in 2023. Thank you all for the patchwork solution tough.
pwcd commentedon Nov 13, 2025
Hi all,
By inspecting the network requests in Twitch, I found that most of these hashes have changed and, the live collecting one has also changed the required request variables.
Here should be the updated ones i found for
_OPERATION_HASHESaround line 842For the live collecting it now seems for the query to require the variables to include
"includeIsDJ": true.Around line 1653 in twitch.py change it to this:
After applying these changes, my live and VOD/clip collection are both working again.
Hope this helps!
sebastientromp commentedon Nov 14, 2025
I published a new version (which is this repo's master + the changes suggested above) to sebastientromp-chat-downloader if you don't want to bother with creating a new version yourself and only need this update
uwu-crj commentedon Nov 14, 2025
A neat idea. Unfortunately, your patch somehow seems to have lost badge metadata for both VODs and live broadcasts.
gadi-playstream-gg commentedon Nov 14, 2025
what does it means? how can I get the latest changes?
nio-p commentedon Nov 14, 2025
@gadi-playstream-gg
Hello,
@sebastientromp has forked and released a new package.
The package name is "sebastientromp-chat-downloader."
For more information, see the repository below:
https://github.com/sebastientromp/chat-downloader
Furthermore, the original package has not been maintained since 2023.
Therefore, you will need to fork and maintain it yourself, use a volunteer-modified version (such as
sebastientromp-chat-downloader.), or use a different package (e.g., https://github.com/lay295/TwitchDownloader).fo5for commentedon Nov 15, 2025
The metadata for global and channel-specific badges are now retrived by two separate operations, so you would need:
@sebastientromp you may want to include that in your fork