简体   繁体   中英

Parsing Twitch JSON response

I would like to get the user list from someones Twitch channel. Heres my current code:

j = urllib2.urlopen('http://tmi.twitch.tv/group/user/graf_pk/chatters')
j_obj = json.load(j)
print(j_obj['chatters']['viewers'])

The output I'm getting is:

[u'pokenuts123', u'realthotsritehere']

I expect an output of all the user names that can be iterated threw like:

for x in users:
  print x

The result doesn't need to be parsed

j = urllib2.urlopen('http://tmi.twitch.tv/group/user/graf_pk/chatters')
j_obj = json.load(j)
u=j_obj['chatters']['viewers']
for x in u:
    print x

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM