KeyError: 'card' When calling get_user_tweets(...)
david-lev opened this issue · comments
Hi, first of all, thank you for the excellent library, extraordinary investment and maintenance :)
I have a problem that started about a few hours ago. I'm on the latest version (1.5.1) and every time I'm calling get_user_tweets
I get the following error:
xyz_1 | 2024-04-18 09:12:00,069 - root - ERROR - Error while getting tweets for XXXX with account YYYYY
xyz_1 | Traceback (most recent call last):
xyz_1 | File "/app/src/tw.py", line 85, in get_user_tweets
xyz_1 | return await _get_user_tweets(account, twitter_user.tw_id, count)
xyz_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xyz_1 | File "/app/src/tw.py", line 41, in _get_user_tweets
xyz_1 | return await tw_account_to_client(tw_account).get_user_tweets(
xyz_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xyz_1 | File "/usr/local/lib/python3.11/site-packages/twikit/twikit_async/client.py", line 1721, in get_user_tweets
xyz_1 | tweet = Tweet(self, tweet_info, User(self, user_info))
xyz_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xyz_1 | File "/usr/local/lib/python3.11/site-packages/twikit/twikit_async/tweet.py", line 175, in __init__
xyz_1 | 'legacy' in data['card'],
xyz_1 | ~~~~^^^^^^^^
xyz_1 | KeyError: 'card'
I checked and the rest of the requests work as usual. Does the problem appear to other users?
Thank you for reporting a bug!
I fixed it in version 1.5.2