Fetching and saving my Twitter tweets

I have heard quite a few people complaining that tweets on Twitter are erased after some period and they can’t be saved without hassling. A quick googling revealed some options but I can’t say that there was anything satisfying, at least for what I was looking for. The way I’d like to save my tweets would be directly to my system, in a simple text file which I’ll be able to access from any other system if I need so.

To meet this “personal requirements” I implemented a short application in Java. It will fetch the specified feed and save your entries in a specified file. On the next fetch operation, if the user specifies the same destination file, it will just update the file with the new tweets from the feed. The most effective way to get that automatically done is to use it as a daily cronjob.

I have the following entry in my crontab:

$ crontab -l | grep fetch
41 23 * * * ~/xNIX/scripts/backups/fetchTweets.sh

and the scripts all it does is:

$ cat fetchTweets.sh
cd ~/xNIX/scripts/backups
java twitterFetcher http://twitter.com/statuses/user_timeline/17578627.rss ~/myTweets

I wouldn’t consider this as a proper Twitter backup application but more like a hack to get the work done without touching the Twitter API or using an external service that would require more manual work to get the tweets on my system. Also, as it uses the RSS Feed, it’s not suitable for those who tweet massively throughout the day.

Get twitterFetcher.java

Advertisement