-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Ability to Retrieve Following/Followed Users #8
Comments
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. |
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
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 |
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 😅 |
No description provided.
The text was updated successfully, but these errors were encountered: