Skip to content
Keep your Twitter timeline clean and tidy
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

How to keep your Twitter timeline clean and tidy

  1. Download the code.

  2. Register the application on this Twitter developer page.

  3. Copy to and edit the necessary variables. This includes the auth tokens that you will obtain from the page above and the number of tweets you want to have at any given point in time.

  4. It turns out it is very tricky to obtain more than 3200 tweets for a given user. So, in order to batch-delete everything from the beginning, we are going to download the very handy Twitter archive. Go to your settings page and click on Your Twitter archive. Follow the instructions, download the .zip file and then copy the tweets.csv file to the folder containing the code.

  5. Run $ python This will delete all your tweets since the beginning of time and will leave only the most recent n_keep alive (you set this up in your file).

  6. Every day, or hour, or whatever works for you, run This will trim your timeline to the desired size.

And that's it. As long as you keep running the script from point 6, everything will be kept clean and tidy. It should be very easy to modify the code so that, instead of keeping the last N tweets, it keeps the ones from the last D days. I have no time to do this, but if you feel so inclined just take the code and help yourself.

The usual caveats apply: read the code and make sure you understand what it's doing, please do some tests before running it unattended, all under your responsibility, this might break your coffee machine, blah, blah.

Inspired by the code in this blog post.

You can’t perform that action at this time.