Why and How I Back Up My Twitter Tweets

Album Cover: Sea Change

"How could this love, ever changing, never change the way I feel?"
Beck / Lonesome Tears

Posted on June 02, 2012 4:28 PM in Programming
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

One of the things I've always lamented is Twitter's lack of support for searching through tweets by a specific user. Ideally, I'd like to be able to view someone's Twitter timeline and enter a search word or phrase to look for among that user's tweets only.

A few years ago, I had read that the furthest you could go back in your timeline was 2,000 tweets. Since I often use Twitter to track milestones in my kids' lives, like first steps, I'd really like to avoid losing my tweets. Even though Twitter does a good job of making things a lot more accessible via their API, they're just like any other cloud-based service. There's no guaranteeing they won't go away or won't change things in such a way that tweets could get lost forever.

Not being able to easily search my tweets and fearing that I might lose access to some of my tweets from years past, I decided to write a PHP script that would back up my tweets at a regular interval in my own MySQL database, making it easy for me to access every tweet all the way back to my very first and run full-text searches against them all to find tweets about any topic I choose. Sure, others had reached similar conclusions and came up with solutions of their own, but I took it as a learning experience to solve my problem and get familiar with the Twitter API at the same time. Two birds with one rock, and what not.

The result of my efforts has been running via a cron job for a few years now, and as a result, I can point you to every tweet where I've ever mentioned a milkshake.

In case anyone is interested in setting up an automated backup like mine and has access to things like PHP and MySQL, I've shared out a version of my script on GitHub.

Comments

vruvljai on May 15, 2017 at 5:23 AM:
instagram on November 13, 2018 at 10:34 PM:

I didn't know that Twitter tweets could be backed up. I think my Twitter tweets are not necessary to be backed up.

Permalink

Post Comments

If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.

Name:

Email Address:

Website:

Comments:

Check this box if you hate spam.