twitch: Handle responses without cursor value
This commit is contained in:
parent
ca2b4f4d59
commit
821389605a
1 changed files with 2 additions and 0 deletions
|
@ -152,6 +152,8 @@ class TwitchClient:
|
||||||
data = self.do_q_auth_v6(init_q_template.format(base, lang, 100, game_id), header)
|
data = self.do_q_auth_v6(init_q_template.format(base, lang, 100, game_id), header)
|
||||||
while len(data.get('data', [])) > 0: # there must be non zero value, but search is kinda broken now
|
while len(data.get('data', [])) > 0: # there must be non zero value, but search is kinda broken now
|
||||||
result['streams'].extend(data['data'])
|
result['streams'].extend(data['data'])
|
||||||
|
if data['pagination'].get("cursor", None) is None: # sometimes server return results without cursor
|
||||||
|
break
|
||||||
data = self.do_q_auth_v6(q_template.format(base, lang, 100, data['pagination']['cursor'], game_id), header)
|
data = self.do_q_auth_v6(q_template.format(base, lang, 100, data['pagination']['cursor'], game_id), header)
|
||||||
return self.unique_streams_v6(result)
|
return self.unique_streams_v6(result)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue