Skip to content

Commit

Permalink
Prevent KeyError while initializing tweet
Browse files Browse the repository at this point in the history
  • Loading branch information
pothitos committed Apr 23, 2024
1 parent 21b1ab3 commit 1aec953
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion twikit/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ def search_tweet(
if 'result' not in tweet_info['core']['user_results']:
continue
user_info = tweet_info['core']['user_results']['result']
results.append(Tweet(self, tweet_info, User(self, user_info)))
if 'legacy' in tweet_info:
results.append(Tweet(self, tweet_info, User(self, user_info)))

if next_cursor is None:
if product == 'Media':
Expand Down
3 changes: 2 additions & 1 deletion twikit/twikit_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,8 @@ async def search_tweet(
if 'result' not in tweet_info['core']['user_results']:
continue
user_info = tweet_info['core']['user_results']['result']
results.append(Tweet(self, tweet_info, User(self, user_info)))
if 'legacy' in tweet_info:
results.append(Tweet(self, tweet_info, User(self, user_info)))

if next_cursor is None:
if product == 'Media':
Expand Down

0 comments on commit 1aec953

Please sign in to comment.