You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Probably raise an EmptyResponse exception instead of a KeyError
Error Trace
Put the error trace below if there's any error thrown.
Traceback (most recent call last):
File "/home/scripts/tiktok/tiktok_api.py", line 204, in <module>
asyncio.run(scrap_tiktok_users())
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/scripts/tiktok/tiktok_api.py", line 175, in scrap_tiktok_users
users_data = [await user.info() for user in users]
File "/home/scripts/tiktok/tiktok_api.py", line 175, in <listcomp>
users_data = [await user.info() for user in users]
File "/home/.local/lib/python3.10/site-packages/TikTokApi/api/user.py", line 87, in info
self.__extract_from_data()
File "/home/.local/lib/python3.10/site-packages/TikTokApi/api/user.py", line 204, in __extract_from_data
data["userInfo"]["user"]["id"],
KeyError: 'user'
Desktop:
OS: Ubuntu 22
TikTokApi Version 6.2.1
The text was updated successfully, but these errors were encountered:
I seem to have the same issue with one of the accounts I scrape from, the account is totally public and there are no issues regarding some restrictions or something of that nature.
Describe the bug
Certain accounts do not send userInfo, which triggers a KeyError when doing
user(username)
{'extra': {'fatal_item_ids': [], 'logid': '20240308185549696ABBB4D8D733706647', 'now': 1709924160000}, 'log_pb': {'impr_id': '20240308185549696ABBB4D8D733706647'}, 'statusCode': 10221, 'status_code': 0, 'status_msg': '', 'userInfo': {}}
The buggy code
The user example with a small account name.
Expected behavior
Probably raise an EmptyResponse exception instead of a KeyError
Error Trace
Put the error trace below if there's any error thrown.
Desktop:
The text was updated successfully, but these errors were encountered: