twikit icon indicating copy to clipboard operation
twikit copied to clipboard

get_tweet_by_id() throws IndexError

Open victoria-n-w opened this issue 1 year ago • 0 comments

  File "/home/victoria/projects/get_tweets.py, line 29, in get_tweet
    tweet = client.get_tweet_by_id(tweet_id)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/victoria/projects/venv/lib64/python3.11/site-packages/twikit/client.py", line 1398, in get_tweet_by_id
    entries = find_dict(response, 'entries')[0]
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

here's how I create the client:

client = Client("en-US")

client.load_cookies("cookies.json")

I"m trying to get a tweet with id 284705391957401601

it's possible that the tweet I'm trying to get was deleted maybe - in that case maybe a different error would be better than IndexError?

victoria-n-w avatar May 08 '24 16:05 victoria-n-w