minimaxir / download-tweets-ai-text-gen

Python script to download public Tweets from a given Twitter account into a format suitable for AI text generation.
MIT License
221 stars 41 forks source link

Don't fail on the last page #13

Closed BenMusch closed 4 years ago

BenMusch commented 4 years ago

Running the script locally, runs into an error at the very end where tweet_data seems to be empty:

  File "download_tweets.py", line 145, in <module>
    fire.Fire(download_tweets)
  File "/Users/ben_muschol/Envs/billionaire-YY-tRWzw/lib/python3.7/site-packages/fire/core.py", line 138, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/Users/ben_muschol/Envs/billionaire-YY-tRWzw/lib/python3.7/site-packages/fire/core.py", line 471, in _Fire
    target=component.__name__)
  File "/Users/ben_muschol/Envs/billionaire-YY-tRWzw/lib/python3.7/site-packages/fire/core.py", line 675, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "download_tweets.py", line 136, in download_tweets
    .utcfromtimestamp(tweet_data[-1].datetime / 1000.0)
minimaxir commented 4 years ago

LGTM. Thanks!