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.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
config-sample.py
delete_from_archive.py
delete_tweets.py

README.md

How to keep your Twitter timeline clean and tidy

  1. Download the code.

  2. Register the application on this Twitter developer page.

  3. Copy config-sample.py to config.py 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 delete_from_archive.py. 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 config.py file).

  6. Every day, or hour, or whatever works for you, run delete_tweets.py. 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.