xenova / chat-downloader

A simple tool used to retrieve chat messages from livestreams, videos, clips and past broadcasts. No authentication needed!
https://chat-downloader.readthedocs.io/
MIT License
936 stars 131 forks source link

[BUG] "AttributeError: 'NoneType' object has no attribute 'get'" when trying to get Twitch chats #217

Open miminashii opened 1 year ago

miminashii commented 1 year ago

Basic information

Describe the bug

"AttributeError: 'NoneType' object has no attribute 'get'" occurs when trying to get Twitch chats. I tried running the command below several times, and got the same AttributeError at different chats.

Command/Code used

If running from the command line, provide the following:

  1. The command used (including the verbose tag, -v):
    python -m chat_downloader "https://www.twitch.tv/videos/1860464348" -v --output "./1860464348.json"
  2. Output from the above command:
    2:41:40 | ドスケベ番長: アクセル踏みすぎたな!!
    2:41:40 | (3-Month Subscriber, cheer 1) もーやおーらんど: 綺麗に落ちた
    2:41:41 | (Prime Gaming) s_rio__ekus: なんだやろなぁ???
    2:41:42 | (2-Month Subscriber, cheer 100) haanzooou: tomeruBURNING tomeruBURNING tomeruBURNING tomeruBURNING
    [DEBUG] Total number of messages: 5211
    [DEBUG] https://gql.twitch.tv:443 "POST /gql HTTP/1.1" 200 214
    [DEBUG] Session closed.
    Traceback (most recent call last):
    File "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "C:\Users\xxxxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\chat_downloader\__main__.py", line 4, in <module>
    main()
    File "C:\Users\xxxxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\chat_downloader\cli.py", line 194, in main
    run(**args.__dict__)
    File "C:\Users\xxxxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\chat_downloader\chat_downloader.py", line 360, in run
    for message in chat:
    File "C:\Users\xxxxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\chat_downloader\sites\common.py", line 283, in __next__
    item = next(self.chat)
           ^^^^^^^^^^^^^^^
    File "C:\Users\xxxxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\chat_downloader\sites\twitch.py", line 1172, in _get_chat_messages_by_vod_id
    comments = info.get('comments')
               ^^^^^^^^
    AttributeError: 'NoneType' object has no attribute 'get'

    If the output is too long, you can attach a text file or remove output which does not constitute to the problem.

miminashii commented 1 year ago

I just ran that command again and it worked without error. This may have been a temporary problem.