Closed Assaf21 closed 2 years ago
Probably with the latest update we lost the ability to load more than 100 followers. Someone knows a page on Twitch where It's possible to find all the followers?
that mean i cant load more than 100 in the current time
Probably with the latest update we lost the ability to load more than 100 followers. Someone knows a page on Twitch where It's possible to find all the followers?
This website "https://twitchinsights.net/followlist" show's all followers (i think), it's atleast over 100, i can confirm
The offeset are limited to 100 channel :
The solution would be to make the first call on the first 100 items. Then look at the _total value to see if you should continue to query the next 100 items.
The solut
The offeset are limited to 100 channel :
The solution would be to make the first call on the first 100 items. Then look at the _total value to see if you should continue to query the next 100 items.
The solut
:thinking: uhm here we don't use the kraken api
Ah shame. With the twitchinsights client_id, I managed to get the users. By not forgetting to add the twitch api in the constant and replacing your client_id with theirs.
And add value to header : "Accept: application/vnd.twitchtv.v5+json"
Edit: I'm on "wout-helix-api" branch
PR are welcome ^^
while 1
woo...
Maybe a better approach to this would be something like:
def get_followers(self, limit=100, offset=0):
followers = {}
json_response = <make query>
followers += [<process response>]
if <has next page (maybe can be when len(followers) == limit)>:
followers += get_followers(limit, offset + limit)
return followers
This way this is way more flexible as the limit
can be changed, and doesn't have kinda "tricky" loops like while 1
.
Also just something that can be investigated, but I think would be nice to have a different sort order. Like by name for example. Like that the ordering is constant and gives a sense of progression (we know that if we're at names starting by z
, we're near the end).
It works. I try to do a PR during the day.
def __do_kraken_request(self, query, response_as_json=True):
url = f"{API}/{query.strip('/')}"
response = self.twitch_login.session.get(url)
logger.debug(
f"Query: {query}, Status code: {response.status_code}, Content: {response.json()}"
)
return response.json() if response_as_json is True else response
def get_followers(self, limit=100, offset=0):
followers = []
query = f"/kraken/users/{self.twitch_login.get_user_id()}/follows/channels?limit={limit}&direction=asc&sortby=login&offset={offset}"
json_response = self.__do_kraken_request(query)
followers += [i["channel"]["name"] for i in json_response["follows"]]
if len(followers) == limit:
followers += self.get_followers(limit, offset + limit)
return followers
Users are sorted for those who are not personalised.
i have more than 100 followers and i need to load more than 100
can i ?? , if i can how
Have you any chance to test this PR #341 ?
i have more than 100 followers and i need to load more than 100
can i ?? , if i can how