davidteather / TikTok-Api

The Unofficial TikTok API Wrapper In Python
https://davidteather.github.io/TikTok-Api
MIT License
4.74k stars 959 forks source link

[FEATURE_REQUEST] - Method for follower count #241

Closed dylanbarne closed 4 years ago

dylanbarne commented 4 years ago

I would like a function to get the amount of followers a user has as the data returned from the get user method is not easy to filter due to its format

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.92. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

duplicate-issues[bot] commented 4 years ago

Hey @dylanbarne,

We did a quick check and this issue looks very darn similar to

This could be a coincidence, but if any of these issues solves your problem then I did a good job :smile:

If not, the maintainers will get to this issue shortly.

Cheers, Your Friendly Neighborhood ProBot

davidteather commented 4 years ago

Here's code to do that. All the information is in dictionary formatting. I am not planning to add methods for each of the statistics as that's a bit redundant.

from TikTokApi import TikTokApi
api = TikTokApi()
tiktok_username = "therock"

user_data = api.getUser(tiktok_username)
followers = user_data['userInfo']['stats']['followerCount'] 
print(followers) # prints number of followers for the given user