Archiving Tweets with Python

  Last week, I posted some R code that downloads the user and timestamp of tweets that contain a given hashtag going back as far as Twitter search will allow.  As I noted in the post, the text of these tweets isn’t stored because of encoding issues with R and its JSON packages.  A few people emailed asking for a version of the code that can archive the tweet text as well, and so I cleaned up my Python code for the task.  The code, as posted below the break and on GitHub, supports resuming downloads and only uses standard Python libraries. You should be able to copy the methods and start downloading with just a call like doSearch("#ff") or doSearch("#feb17").