Delete all tweets with Ruby

I've been on Twitter since 2008 (@kirillzubovsky) and have since accumulated about 15.4K tweets, until yesterday that is. Wondering what the internet does with its public data, I made a quick Ruby script that deleted all my tweets up until a couple of months ago. Here are the details, if you'd like to delete your own tweets.

Before you start, you need to do two things:

(1) Go to your twitter account and click on the gear icon in the top-right. Go to Settings, and under Account, look for "Your Twitter archive" option. Click the button to request your archive and wait for Twitter to send you a download link. It only takes a few minutes.

(2) Go to https://dev.twitter.com and register an application that has Read & Write permissions to your account. Make sure when you do, the app actually has the Write permissions, otherwise it won't work.

Twitter will send you a folder called "tweets" with a bunch of .js files in, which contain metadata about each tweet.

If you point the script to that folder, it will simply iterate through each file, deleting each tweet from those files.

Here's the actual script. It is extremely simple.

The script does not have threads, and it does not check to see if it's about to fail to do API restrictions on call volume. However, I was able to delete about 15,000 tweets in a span of an hour by doing about 1-year worth of tweets at a time. I simply copy-pasted a subset of "tweet" files into a folder, one year at a time.

I ran this app as a simple Sinatra application. So once you have the necessary gems installed, just type ruby tweetDelete.rb and it will run through the script.