Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetTwitchData.py Streamer name doesn't match Twitch url #6

Open
apoordev opened this issue Apr 4, 2021 · 0 comments
Open

GetTwitchData.py Streamer name doesn't match Twitch url #6

apoordev opened this issue Apr 4, 2021 · 0 comments

Comments

@apoordev
Copy link

apoordev commented Apr 4, 2021

GetTwitchData.py has an issue with some user names and will run into an error.

Getting viewers for 악어...
Traceback (most recent call last):
  File "C:/Scripts/VisualizingTwitchCommunities/DataCollection/main.py", line 17, in <module>
    main()
  File "C:/Scripts/VisualizingTwitchCommunities/DataCollection/main.py", line 11, in main
    dict = GetTwitchData.GetDictOfStreamersAndViewers(json) #Create a dictionary of {streamer:[viewers]} from those 100 streams
  File "C:\Scripts\VisualizingTwitchCommunities\DataCollection\GetTwitchData.py", line 44, in GetDictOfStreamersAndViewers
    viewers = getCurrentViewersForChannel(streamer.lower()) #Get viewers for a particular streamer
  File "C:\Scripts\VisualizingTwitchCommunities\DataCollection\GetTwitchData.py", line 29, in getCurrentViewersForChannel
    r = requests.get('http://tmi.twitch.tv/group/user/'+ channel.lower() +'/chatters').json()
  File "C:\Users\%User%\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)

I was able to fix it by just changing line 41 in GetTwitchData.py from user_name to user_login. user_login uses the streamers url name in cases where the streamers stream name and url are different

    streamers = [element['user_login'] for element in j['data']] #Get just the list of streamers
@apoordev apoordev changed the title GetTwitchData.py Streamer name doesn't match url GetTwitchData.py Streamer name doesn't match Twitch url Apr 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant