Takes your Twitter export file and turns it into CSV files. Everyone loves CSV files.
MIT license (see file LICENSE). (c) 2023 John Mueller / johnmu.com
# get repo
git clone https://github.com/softplus/twitter_export
cd twitter_export
# setup python stuff, virtualenv -- recommended
virtualenv .venv && source .venv/bin/activate
pip install -r requirements.txt
# ... run things now ...
# ... when done ...
deactivate
- Make a copy of
_settings_sample.py
and call it_settings.py
- Follow the guide at https://python-twitter.readthedocs.io/en/latest/getting_started.html to create a new Twitter app, and to get your tokens.
- When creating an app, you can use any URL.
- Copy
API Key
,API Key Secret
, andBearer Token
into the appropriate fields in_settings.py
That's all. I think
Extract your Twitter archive and place it in the twitter
folder here.
This folder should include sub-directories for assets
and data
.
source .venv/bin/activate
# ...
# read all your own tweets, store Q&A as CSV in files in /output/
python3 json_to_csv.py
# compile threads where you reply to your own tweets
python3 csv_to_threads.py
# create Q&A CSV file to feed your NLG
# This takes a long time, it fetches the tweets you replied to via Twitter API.
# Note: you must set up the Twitter API first.
# Tweepy will pause when your API quota needs it.
python3 csv_to_qa.py
# that's all folks
deactivate
Some of the code uses tweepy
to access the Twitter API.
- compile popular threads to drop onto blog
- export all tweets to csv
- export all posts with images
- stats on tweets/month, tweets/daytime, time-to-reply
Drop me a post at https://johnmu.com/+