Main goals:
- Gather Twitter user's hashtags and analyze them.
- Visualize data in a creative way.
First clone the repo. I'm using Python 3.6 with the following packages:
To install all dependencies create a virtual env and run:
pip install -r requirements.txt
Now that we have all the requirements, we need to create a Twitter App.
In order to extract tweets for a posterior analysis, we need to access to our Twitter account and create an app. The website to do this is https://apps.twitter.com/. (If you don't know how to do this, you can follow this quick tutorial video to create an account and an application.)
From this app that we're creating we will save the following information the credentials.py
script:
- Consumer Key (API Key)
- Consumer Secret (API Secret)
- Access Token
- Access Token Secret
The content of this script is the following:
# ===============================================================
# Author: Rodolfo Ferro Pérez
# Email: ferro@cimat.mx
# Twitter: @FerroRodolfo
#
# Script: Access keys for Twitter App.
#
# ABOUT COPYING OR USING PARTIAL INFORMATION:
# This script was originally created by Rodolfo Ferro. Any
# explicit usage of this script or its contents is granted
# according to the license provided and its conditions.
# ===============================================================
# Consumer:
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
# Access:
ACCESS_TOKEN = ''
ACCESS_SECRET = ''
Feel free to check the demo notebook from the repo or directly from Jupyter nbviewer!
An example of visualization of hashtags from @pybites using a mask of the Twitter bird is the following one: