TikTokAPI-Python
TikTokAPI-Python copied to clipboard
The api randomly does not let me get data from the getVideosByUserName method
I have a bot that retrieves the tik tok of an user every minute. But now It just gives this key error:
line 118, in getVideosByUserName user_obj = user_data["userInfo"]["user"] KeyError: 'userInfo'
Here is my code :
def get_tikTok(username):
api = TikTokAPI(cookie=None)
videos_obj = api.getVideosByUserName(username, count=3)
ok, try to extend the library, and make your own get video by user id and secu_id. Sinve the getVideoByUserName, calles 2 endpoints:
- the get user info endpoint
- get the user videos by user id and user secu id
this way you are pushing to much, and they might bann you. when they do that, you are going to miss the userInfo key, and that will be empty, so you will get this error. If you repeat this process for known users, save their user_id and secu_id to use later, this way you optimize the connections.
I am confuse on how I can do this, I am working on a school project and I am getting the same error as Harbe, can you show an example thanatos.