Downloading Tweets by a List of Users
This post is a brief, temporary attempt at pointing people in the right direction for a common task: downloading tweets sent by a number of different Twitter users. It is directed at those who are new to Python and/or downloading data from the Twitter API.
OK, so I am assuming you have made it through (or intend to) the following tutorials, which should help you get set up and working with Python:
Another detailed tutorial I have created, Usint Python to Grab Twitter User Data, is intended to serve as an introduction to how to access the Twitter API and then read the JSON data that is returned. This gets you the account-level data for a Twitter user (such as when the account was created), but not the actual tweets. That is a more difficult process, but not a huge leap once you’ve made it through all of the above steps.
I have yet to upload a tutorial showing how to use my code to download tweets by a list of Twitter users, but fortunately my PhD student Wayne Xu has. This tutorial helps fill in the blanks. It will help walk you through the steps of getting a Twitter developer account (so you can access the API), of which database to use (SQLite), and then how to access and store data from the Twitter user_timeline API, which allows you to download up to the last 3,200 tweets sent by each Twitter user.
I hope this helps. Happy coding!