Skip to content
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

Issue with User #1138

Open
selimbayar opened this issue Apr 5, 2024 · 2 comments
Open

Issue with User #1138

selimbayar opened this issue Apr 5, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@selimbayar
Copy link

I am trying the user example without changing anything, but I am getting a KeyError.

async def user_example():
async with TikTokApi() as api:
await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3)
user = api.user("therock")
user_data = await user.info()
print(user_data)

    async for video in user.videos(count=30):
        print(video)
        print(video.as_dict)

This is the starter example code to get a user.

line 24, in
asyncio.run(user_example())
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/Users/selimbayar/Desktop/testTiktok.py", line 13, in user_example
user_data = await user.info()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/TikTokApi/api/user.py", line 87, in info
self.__extract_from_data()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/TikTokApi/api/user.py", line 204, in __extract_from_data
data["userInfo"]["user"]["id"],
KeyError: 'id'

This is the error message. Is this an error on the Api end?

@selimbayar selimbayar added the bug Something isn't working label Apr 5, 2024
@r3215407
Copy link

r3215407 commented Apr 9, 2024

I got same problem. Has anyone solve ?

@Gereks123
Copy link

Gereks123 commented Apr 12, 2024

For me personally it seems to be happening on certain users. Although I get an error that "data["userInfo"]["user"]["id"]" KeyError: 'user'.

Not entirely sure what the issue is, for me the userInfo is completely empty for a certain account that I am fetching videos from. I checked that the account does not have any restrictions or privated videos.

EDIT: Same issue (#1124)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants