twikit icon indicating copy to clipboard operation
twikit copied to clipboard

KeyError: 'entries'

Open s-vigneshwaran opened this issue 6 months ago • 1 comments

await user.get_tweets('Tweets', count=20) throws this error. I'm sure this is a error for some handes and not all handles. Specifically handles with 0 tweets in their profiles.

File [~/anaconda3/envs/notebook/lib/python3.12/site-packages/twikit/user.py:170](http://localhost:8888/home/shankavn/anaconda3/envs/notebook/lib/python3.12/site-packages/twikit/user.py#line=169), in User.get_tweets(self, tweet_type, count)
    131 async def get_tweets(
    132     self,
    133     tweet_type: Literal['Tweets', 'Replies', 'Media', 'Likes'],
    134     count: int = 40,
    135 ) -> Result[Tweet]:
    136     """
    137     Retrieves the user's tweets.
    138 
   (...)
    168     ...
    169     """
--> 170     return await self._client.get_user_tweets(self.id, tweet_type, count)

File [~/anaconda3/envs/notebook/lib/python3.12/site-packages/twikit/client/client.py:1918](http://localhost:8888/home/shankavn/anaconda3/envs/notebook/lib/python3.12/site-packages/twikit/client/client.py#line=1917), in Client.get_user_tweets(self, user_id, tweet_type, count, cursor)
   1915     return Result([])
   1916 instructions = instructions_[0]
-> 1918 items = instructions[-1]['entries']
   1919 next_cursor = items[-1]['content']['value']
   1920 previous_cursor = items[-2]['content']['value']

KeyError: 'entries'

s-vigneshwaran avatar Jun 11 '25 11:06 s-vigneshwaran

i'm getting a similar error, but key error value instead.

ObiAU avatar Jun 20 '25 14:06 ObiAU