Open M1kep opened 1 year ago
This is still useful for retrieving your own following/followed users. For example, I'm writing a program to give me desktop notifications when someone I'm following posts a new TikTok. It's actually pretty simple to retrieve, too- you just need a sessionid. Here's how I did it using Python requests
def get_following():
print("Getting following list")
return requests.get(
"https://www.tiktok.com/api/user/list",
{"count": 10000, "minCursor": 0},
cookies={"sessionid": SESSION_ID}
).json()['userList']
This is still useful for retrieving your own following/followed users. For example, I'm writing a program to give me desktop notifications when someone I'm following posts a new TikTok. It's actually pretty simple to retrieve, too- you just need a sessionid. Here's how I did it using Python requests
def get_following(): print("Getting following list") return requests.get( "https://www.tiktok.com/api/user/list", {"count": 10000, "minCursor": 0}, cookies={"sessionid": SESSION_ID} ).json()['userList']
Is the sessionid linked to a specific login?
I've used the same session ID for a few days now and it hasn't expired, so either it has a long expiration date or it isn't linked to a specific login. And if it is, I remember seeing something about how to obtain a new session ID anyways
It seems like it would need to be linked to a login if that's the only information provided to the API to collect the list of followed by a specific account. There's no other information about what account to get that information for as far as I can tell.
Oh I thought by login you meant it would expire if you get logged out, but I'm guessing you just mean account. Yes, it's linked to your account
After poking around a bit, it looks like the endpoint https://www.tiktok.com/api/user/list/
is used to populate following and followers lists. This endpoint can be used anonymously if the following parameters are passed:
Returns an object with status code 10222 if privacy settings blocks this. Presumably, having a session ID that corresponds to being logged in to the account in question would bypass the privacy settings.
With this in mind, this is definitely a feature that can be implemented. I'll get working on it.
There's a new interesting issue I'm seeing when trying to use this endpoint, I can only ever seem to get up to about 4.5 thousand results through the iterative process with minCursor
There's a new interesting issue I'm seeing when trying to use this endpoint, I can only ever seem to get up to about 4.5 thousand results through the iterative process with minCursor
I'm curious how you tested this so quickly- do you just casually follow that many people anyways? I thought I was bad for following 21 people lol.
Thanks for developing this module so actively, by the way!
There's a new interesting issue I'm seeing when trying to use this endpoint, I can only ever seem to get up to about 4.5 thousand results through the iterative process with minCursor
I'm curious how you tested this so quickly- do you just casually follow that many people anyways? I thought I was bad for following 21 people lol.
Thanks for developing this module so actively, by the way!
No lol it was actually somewhat tricky to find an account that followed ~5000 people and had ~5000 followers. TikTok really likes promoting content and creators it thinks you will like, so I had to go down quite a rabbit hole before I could find an account to test with. It was easy to find an account with a large number of followers (TikTok itself has over 60 mil) so that's what I initially tested with.
Oh, I didn't even realise you could view the accounts following/followed (by) an account you're not logged into at all. Goes to show how little I use TikTok I suppose 😅
TikTok does not provide any API or interface to find this information about any User other than yourself (when logged in). You can only view your own follow/following lists, even in the app or on the website.
As far as I know, this is impossible to do unless TikTok makes this available somehow.