Python Tutorials for Downloading Twitter Data

1072645_98618032

I often get requests to explain how I obtained the data I used in a particular piece of academic research. I am always happy to share my code along with my data. Having been through the learning process myself about 5 years ago, I understand the confusion and frustration that can go along with learning a programming language. There are a number of new concepts going on all at once, which can make it difficult to wrap your head around.

For this reason, I have created a number of tutorials. In the table below I list all of these tutorials to date. They are designed primarily for the user who is a complete neophyte to computer programming, though intermediate and some advanced users may find some of the actual code helpful. For those of you who are new to Python, I recommend going through these tutorials in order. Each introduces only one or two new concepts at a time, which will make the learning process easier.

I should also mention that the focus of these tutorials is for those who want to download and analyze Twitter data. For social media researchers this is the best place to start. After you are comfortable with that then it is easier to branch out to studying Facebook and other social media platforms.

TutorialDescription
Why I Use Python for Academic ResearchOverview of how I use Python for data gathering, data manipulation, and data visualization and analysis.
Python: Where to Start?Overview of how to think about using and learning Python. Recommendation on which version of Python to install.
Running your first codeRunning your first Python code using my preferred installation: Anaconda Python 2.7
Four ways to run your codeShows my preferred methods for running Python code.
Setting up Your Computer to Use My Python CodeCovers pre-requisites for successfully running my Twitter code -- additional modules to install, database set-up, etc.
Setting up Access to the Twitter APIGetting your Twitter API 'library card' (your API key password)
Using Python to Grab Twitter User DataThe first Twitter code you should run. Introduction to how to access the Twitter API and then read the JSON data that is returned. For users' Twitter account data (such as when the account was created, how many followers, etc.). Follow-up tutorials cover how to download tweets.
Tag Cloud TutorialHow to create a tag cloud from a set of downloaded tweets.
Downloading Hashtag TweetsHow to download tweets with a given hashtag and save into an SQLite database. Wayne Xu's tutorial.
Downloading Tweets by a List of UsersDownloading tweets sent by a number of different Twitter users. For those who are new to Python and/or downloading data from the Twitter API. Wayne Xu's tutorial.
Downloading Tweets-Take IIDownloading tweets sent by a number of different Twitter users: Take II. My own, more detailed explanation of SQLite, JSON, and the Twitter API, along with a full copy of the Python code.

 

I hope this helps. Happy coding!