Twitter and Instagram Hashtag Grabbing with Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
TAGS_data
data
js
Pipfile
Pipfile.lock
README.md
combine_csv.py
combine_csv_and_classify.py
display_posts_with_downloaded_media.html
instagram_hashtag_grabbing.py
twitter_hashtag_grabbing.py

README.md

Twitter and Instagram Hashtag Grabbing with Python

Austin Meyers - Intro to Digital Humanities Guest Lecture

These are the materials from a presentation I gave to the Introduction to Digital Humanities course at Columbia College Chicago on July 11, 2018. Many thanks to Sean Andrews for the opportunity.

Install

  1. Make sure you have python 3 running on your computer
  2. Install PipEnv, follow the installation instructions: https://github.com/pypa/pipenv
  3. Using the terminal, navigate to the downloaded folder and run "pipenv install". This will install all the dependencies
  4. That's it for global setup, you will need special credentials for twitter and instagram, follow the instructions in the

twitter_hashtag_grabbing.py

Simple script to grab files from

Create Twitter App using Twitter's Developer Poral

  1. Login to https://developer.twitter.com/
  2. Go to https://developer.twitter.com/en/apps
  3. Click "Create New App" and fill in your app details
  4. Once you click "Create" you should be able to navigate to "Keys & Tokens", fill in the consumer_key, consumer_secret, access_token and access_token_secret with these values

Run

Run with pipenv by running:

pipenv run python twitter_hashtag_grabbing.py whatEverHashTagYouWant

instagram_hashtag_grabbing.py

Setup

Make sure to add "yourUsername" and "yourPassword" to the file and that's it.

Run

Run with pipenv by running:

pipenv run python instagram_hashtag_grabbing.py whatEverHashTagYouWant

References

display_posts_with_downloaded_media.html

Simple demo of how you might display this data.

Run

You may need to create a simple local server to serve this page... on my mac either of this command work great, just navigate to the root of the downloaded repo and run: python -m http.server

combine_csv.py

This script combines two csv's into a single csv for analysis.

Run

pipenv run python combine_csv.py relativePath/to/your/first.csv relativePath/to/your/second.csv

#combine_csv_and_classify.py

Last min demo for presentation.... same as the above, but add imagenet classification to the media. THis is basically just https://github.com/tensorflow/models/blob/master/tutorials/image/imagenet/classify_image.py with the combine_csv.py shoved in.

Run

pipenv run python combine_csv.py relativePath/to/your/first.csv relativePath/to/your/second.csv

Going further...

If you have an questions or issues, pleas feel free to contact me. I will be working on a variety of other projects that build out of this one, so feel free to star this repo or follow me (here, https://twitter.com/ak5a, https://www.instagram.com/ak5a/) and I'll be posting updates in the near future.