This repository was created for UArizona's Research Bazaar workshop on Scraping Twitter in Python. This code was written with the intention of providing an interactive workshop using Python in Spyder.
See the .pdf for Getting Started for Scraping Twitter specifically for this workshop.
Applying for a Twitter Developer Account
- Apply for and create a Twitter developer account
- Once your account is approved, create an app by logging in with the account above and following the instructions.
- Here is more information on Twitter apps.
- Once your app is created, locate your individual Consumer API Keys and Access tokens.
What you need in Python
pip install tweepy
pip install wordcloud
We are using glob to concatenate the csv files, and I have an older version. You may need to install this if you've never used it before:
pip install glob2
- Open your command line (Command Prompt or Powershell for PC users).
- Type the above commands and press enter.
pip install tweepy
- This can also be done in Spyder.
!pip install tweepy
We will be using some regular expressions to parse tweets. Here are some quick guides and resources.
This code and workshop was written using Python 3.7.4 with the Anaconda distribution.
- Darla Still
- Base code borrowed from the 2019 Twitter scraping workshop at Computational Social Science Mini Conference at UArizona by Emmi Bevensee
- Links for additional resources and inspiration for this code:
- Scraping Twitter - Towards Data Science
- Code for above link
- Basic Tweet Preprocessing
- How to create a Mask Word Cloud
- Simple code to count words