twitchy icon indicating copy to clipboard operation
twitchy copied to clipboard

TypeError: 'NoneType' object is not subscriptable

Open Ecliptix opened this issue 4 years ago • 20 comments

I've been getting this error since a day or two ago when running twitchy, in any mode beyond configuration. Installed from the twitchy-git AUR package, which I also tried updating but that didn't help.

$ rm -rf ~/.config/twitchy3
$ twitchy --configure
 Configure:
 Media player [mpv]:
 Default stream quality [low/medium/HIGH/source]:
 Truncate stream status at [AUTO]:
 Interval (seconds) in between channel status checks [60]:

 Current Settings:
 Media player: mpv
 Default Quality: high
 Truncate status at: 0
 Check interval: 60
 Does this look correct to you? [Y/n]:
 Config written to /home/XXXXXX/.config/twitchy3/twitchy.cfg. Read for additional settings.

$ twitchy -a gogcom
 Additions to database:
Traceback (most recent call last):
  File "/usr/bin/twitchy", line 11, in <module>
    load_entry_point('twitchy==3.4.0', 'console_scripts', 'twitchy')()
  File "/usr/lib/python3.8/site-packages/twitchy/__main__.py", line 377, in main
    channel_addition('add', args.a)
  File "/usr/lib/python3.8/site-packages/twitchy/__main__.py", line 45, in channel_addition
    valid_channels = twitchy_api.name_id_translate(
  File "/usr/lib/python3.8/site-packages/twitchy/twitchy_api.py", line 87, in name_id_translate
    for i in stream_data['data']:
TypeError: 'NoneType' object is not subscriptable

$ twitchy -s XXXXXX
 Additions to database:
Traceback (most recent call last):
  File "/usr/bin/twitchy", line 11, in <module>
    load_entry_point('twitchy==3.4.0', 'console_scripts', 'twitchy')()
  File "/usr/lib/python3.8/site-packages/twitchy/__main__.py", line 404, in main
    channel_addition('sync', args.s)
  File "/usr/lib/python3.8/site-packages/twitchy/__main__.py", line 48, in channel_addition
    valid_channels = twitchy_api.sync_from_id(channels)
  File "/usr/lib/python3.8/site-packages/twitchy/twitchy_api.py", line 118, in sync_from_id
    username_id = name_id_translate(
  File "/usr/lib/python3.8/site-packages/twitchy/twitchy_api.py", line 87, in name_id_translate
    for i in stream_data['data']:
TypeError: 'NoneType' object is not subscriptable

$ sudo pacman -Qi twitchy-git
Name            : twitchy-git
Version         : r210.92e5176-1
Description     : CLI streamlink wrapper for twitch.tv
Architecture    : any
URL             : https://github.com/BasioMeusPuga/twitchy
Licenses        : GPL3
Groups          : None
Provides        : twitchy
Depends On      : python  streamlink  python-requests  python-setuptools
Optional Deps   : None
Required By     : None
Optional For    : None
Conflicts With  : twitchy
Replaces        : None
Installed Size  : 155.72 KiB
Packager        : Unknown Packager
Build Date      : Mon 11 May 2020 11:03:55 AM MST
Install Date    : Mon 11 May 2020 11:04:00 AM MST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : None

Ecliptix avatar May 12 '20 07:05 Ecliptix

censured@jelezyaka:~/Documents/rpg-aria$ twitchy -a voodoosh Additions to database: Traceback (most recent call last): File "/usr/local/bin/twitchy", line 11, in load_entry_point('twitchy==3.4.0', 'console_scripts', 'twitchy')() File "/usr/local/lib/python3.8/dist-packages/twitchy-3.4.0-py3.8.egg/twitchy/main.py", line 377, in main channel_addition('add', args.a) File "/usr/local/lib/python3.8/dist-packages/twitchy-3.4.0-py3.8.egg/twitchy/main.py", line 45, in channel_addition valid_channels = twitchy_api.name_id_translate( File "/usr/local/lib/python3.8/dist-packages/twitchy-3.4.0-py3.8.egg/twitchy/twitchy_api.py", line 87, in name_id_translate for i in stream_data['data']: TypeError: 'NoneType' object is not subscriptable

killarbyte avatar May 12 '20 21:05 killarbyte

Apparently twitch has started requiring OAuth authentication for all API requests. Let me take a look at this.

BasioMeusPuga avatar May 12 '20 21:05 BasioMeusPuga

@BasioMeusPuga when i clean install streamlink - it fails to play any stream. After some research > when you change api key streamlink start working properly. Maybe you need to change this api key as well ? I tryed to change it in twitchy/twitchy_api.py under 'Client-ID': but it didnt help. Maybe im doing it wrong.

killarbyte avatar May 13 '20 06:05 killarbyte

Well. This explains why no one has been streaming for a long as time. :)

Any progress?

Hund avatar May 28 '20 18:05 Hund

I've been able to solve this issue by generating a Personal Client-ID and Authorization token, and adding it with following to the twitchy-api.py file. These tokens can be generated using the guide https://dev.twitch.tv/docs/authentication

def api_call(url, params=None):
    try:
        headers = {
            'Client-ID': 'XXXX',
            'Authorization': 'Bearer XXX'
            }

CooperWallace avatar Jul 04 '20 20:07 CooperWallace

I hope this project is still alive? It's to my understanding the only decent CLI client that doesn't require an account?

Hund avatar Oct 14 '20 12:10 Hund

Project seems to be dead. Going to fork it and try to keep it alive

roceb avatar Feb 25 '21 18:02 roceb

Project seems to be dead.

I have found an alternative; wtwitch. It's really good! :)

Hund avatar Feb 25 '21 19:02 Hund

Project seems to be dead.

I have found an alternative; wtwitch. It's really good! :)

Actually, let me check it out. I got this to start working and thought about adding chat in terminal. But If this is better, then its less work for me. Thanks

roceb avatar Feb 25 '21 19:02 roceb

Project seems to be dead.

I have found an alternative; wtwitch. It's really good! :)

Actually, let me check it out. I got this to start working and thought about adding chat in terminal. But If this is better, then its less work for me. Thanks

Cool! Where can we follow your endeavors? Are you on the fediverse?

Hund avatar Feb 25 '21 20:02 Hund

Project seems to be dead.

I have found an alternative; wtwitch. It's really good! :)

Actually, let me check it out. I got this to start working and thought about adding chat in terminal. But If this is better, then its less work for me. Thanks

Cool! Where can we follow your endeavors? Are you on the fediverse?

I forked the project. Just follow me on here. Or watch my fork of it.

roceb avatar Feb 26 '21 00:02 roceb

Edit to anyone coming here looking to solve their issue. I have a working version available right now.

roceb avatar Feb 26 '21 06:02 roceb

Edit to anyone coming here looking to solve their issue. I have a working version available right now.

Your version is broken now.

Hund avatar Apr 22 '21 15:04 Hund

Fixed, let me know. This seems to be an issue whenever twitch changes their API

roceb avatar Apr 22 '21 16:04 roceb

Fixed, let me know. This seems to be an issue whenever twitch changes their API

Thanks! :) It would be easier if you would allow issues on your project as well.

Hund avatar Apr 22 '21 17:04 Hund

Fixed, let me know. This seems to be an issue whenever twitch changes their API

It would be nice if you could make a release as well, it's how I keep myself updated with new updates. :)

Hund avatar Apr 22 '21 17:04 Hund

Done, I'll start automatically deploying pushes to master as a release

roceb avatar Apr 22 '21 18:04 roceb

Done, I'll start automatically deploying pushes to master as a release

Great! I updated to version 3.3.2 and it doesn't work. :/

Hund avatar Apr 23 '21 12:04 Hund

Okay, I'll look into it. Twitch changes their API. I'll build and send a working version

On Fri, Apr 23, 2021, 08:51 Hund @.***> wrote:

Done, I'll start automatically deploying pushes to master as a release

Great! I updated to version 3.3.2 and it doesn't work. :/

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BasioMeusPuga/twitchy/issues/38#issuecomment-825636617, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFC4R2VBSAFAWUBMV4JFGE3TKFUOLANCNFSM4M6R3RTA .

roceb avatar Apr 23 '21 16:04 roceb

Okay, I'll look into it. Twitch changes their API. I'll build and send a working version

this must be anoying but it seems to be rebroken.

yuri0r avatar Mar 11 '22 19:03 yuri0r