Skip to content

Instantly share code, notes, and snippets.

View gdsaxton's full-sized avatar

Gregory Saxton gdsaxton

View GitHub Profile
@gdsaxton
gdsaxton / twitter-user-data.py
Last active December 16, 2018 19:46
Twitter User Information
#!/usr/bin/env python
"""
Use Twitter API to grab user information from list of organizations;
export text file
Uses Twython module to access Twitter API
"""
#!/usr/bin/env python
"""
tags_from_tweets.py - Take hashtags from tweets in SQLite database. Output to text file.
"""
import sys
import re
import sqlite3
@gdsaxton
gdsaxton / friend_follower_lists.py
Last active May 4, 2016 23:21
Loop over list of Twitter user screen_names, create dictionary of users' follower IDs and friend IDs.
for id in screen_names_unique[42:44]:
screen_name = id
print '\n', screen_name
cursor = "-1"
print 'followers list first cursor', cursor
d = get_followers_ids (screen_name, cursor)
@gdsaxton
gdsaxton / Producing Summary Statistics for Publication.ipynb
Last active March 6, 2018 17:25
iPython notebook showing how to run and output a descriptive statistics (summary statistics) table for social scientific publication
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gdsaxton
gdsaxton / Social_Metrics_Tutorial_Script_User_Timeline_All_Pages.py
Created September 25, 2017 17:21
Downloading Tweets by a List of Users -- SQLite Version
#!/usr/bin/env python
"""
Social_Metrics_Tutorial_Script_User_Timeline_All_Pages.py - DOWNLOADS ALL AVAILABLE RECENT
TWEETS FROM 5 MLB ACCOUNTS INTO SQLITE DATABASE
BEFORE RUNNING THIS SCRIPT, YOU WILL NEED TO:
1. HAVE ANACONDA PYTHON 2.7 INSTALLED
2. HAVE CREATED CSV FILE (E.G., IN EXCEL) CONTAINING TWITTER HANDLES YOU
@gdsaxton
gdsaxton / accounts.csv
Created September 25, 2017 17:24
Twitter Account IDs - Sample File
Unique_ID org_name org_url Twitter_URL Twitter_handle earliest_tweet_in_db number_of_tweets_in_db
1 LA Angels http://losangeles.angels.mlb.com/ https://twitter.com/Angels Angels
2 Oakland Athletics http://oakland.athletics.mlb.com/ https://twitter.com/Athletics Athletics
3 Texas Rangers http://texas.rangers.mlb.com/ https://twitter.com/Rangers Rangers
4 Seattle Mariners http://seattle.mariners.mlb.com/ https://twitter.com/Mariners Mariners
5 Chicago White Sox http://chicago.whitesox.mlb.com/ https://twitter.com/whitesox whitesox
@gdsaxton
gdsaxton / Social_Metrics_Tutorial_Script_User_Timeline_All_Pages_MongoDB.py
Last active April 7, 2022 17:04
Downloading Tweets by a List of Users -- MongoDB Version
#!/usr/bin/env python
"""
Social_Metrics_Tutorial_Script_User_Timeline_All_Pages_MongoDB.py - DOWNLOADS ALL AVAILABLE RECENT
TWEETS FROM 5 MLB ACCOUNTS INTO MONGODB DATABASE
BEFORE RUNNING THIS SCRIPT, YOU WILL NEED TO:
1. HAVE ANACONDA PYTHON 2.7 INSTALLED
2. HAVE CREATED CSV FILE (E.G., IN EXCEL) CONTAINING TWITTER HANDLES YOU
WISH TO DOWNLOAD (SEE TUTORIAL FOR DETAILS)
@gdsaxton
gdsaxton / find_duplicates.ipynb
Last active March 15, 2018 18:05
Find Duplicates in List
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gdsaxton
gdsaxton / find_duplicates2.ipynb
Created March 15, 2018 18:08
Find Duplicates in List, Take 2
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.