I've recently decided to get back on Twitter, mostly to expand my professional circle. I realized though that I first joined a while ago and at that time I was definitely using it differently. It became clear that it would be a good idea to do some cleanup and start again with a clean state.
I found a bunch of websites offering to do that for me but I'm not too keen on letting someone else handle my somewhat private data.
I then found on Github quite some scripts doing exactly that but all of them needed API keys and also an archive of your tweets which you need to ask Twitter for.. It's explained quite nicely here and basically require you to register an app with your Twitter account to get the usual keys / tokens (it took them only 5 minutes to accept my request, maybe because my account is old?). Next, you need to ask for a copy of your data (this took maybe an hour for me).
Once you have that it's time to find a script! I looked quite a bit because I wanted a script that let me decide for each tweet if I wanted to keep it or not (the usual command line y/N) but couldn't find any. It also seems Twitter now sends data as a
.js format and they used to send it as
.csv so there's still quite some scripts only working with the later which is not what you want.
I chose the most popular repo and decided to tweak it to my needs. I was looking for a way to install the package and be able to edit the code at the same time. Turns out it's possible and called "Editable installs".
python3.7 -m pip install -e git+https://github.com/koenrh/delete-tweets.git#egg=delete-tweets
Whatever modification you make to the source files will be instantly available when executing
delete-tweets on the command line.
I added the following line to the script but quickly realized that doing this by hand for thousands of tweets / RTs will take ages so I reverted to actually just remove automatically the tweets for a couple of those years and manually do the rest.
for row in TweetReader(tweets, until_date, filters, s, min_l, min_r).read(): if input("%s (y/N) " % row["tweet"].get("full_text")).lower() == 'y': destroyer.destroy(row["tweet"]["id_str"]) count += 1
I also had a final manual pass at my liked tweets and people I follow.. and voila! everything is now cleaned up!
Questions, remarks about this post?
Reach me on Twitter @florianmski