Decided to work with APIv5 later
This commit is contained in:
parent
350d2b8c3e
commit
9b992cce9d
2 changed files with 8 additions and 4 deletions
|
@ -2,6 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from twitch import TwitchClient
|
||||
|
||||
import json
|
||||
|
||||
def main():
|
||||
|
@ -9,9 +10,8 @@ def main():
|
|||
twitch_token = reader.read().strip()
|
||||
|
||||
client = TwitchClient(twitch_token)
|
||||
streams = client.raw_query_v6('streams?game_id=%s&first=100&language=ru&type=live' % client.get_game_id('IRL')[0])
|
||||
for i in streams['data']:
|
||||
print(i['title'])
|
||||
r = client.raw_query_v5('streams/?game=IRL&language=ru&limit=2')
|
||||
print(json.dumps(r, indent=4))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -32,6 +32,10 @@ class TwitchClient:
|
|||
header, base = self.get_base('v6')
|
||||
return self.do_q(base+q, header)
|
||||
|
||||
def raw_query_v5(self, q):
|
||||
header, base = self.get_base('v5')
|
||||
return self.do_q(base+q, header)
|
||||
|
||||
# Returns (ID, GAMENAME) or None
|
||||
def get_game_id(self, name):
|
||||
header, base = self.get_base('v5')
|
||||
|
|
Loading…
Reference in a new issue