TweetDen provides a personal Twitter archive, including a backup of your tweets and a basic front-end for browsing/searching. It is along the lines of Tweet Nest, but in Ruby.
By changing one environment variable ENV['TWEETDEN_SCREEN_NAME']
, this app can be your personal twitter archive.
TweetDen is built in Sinatra and uses Postgres as the backend. I then use Heroku to host it, which you can see here, but you can host it whereever.
Currently, the app does not talk to the Twitter API directly during the request. Instead you use a series of Rake tasks to populate the database. To keep it up to date, you would call rake import:latest
via a cron job whenever you'd like (daily, hourly, etc.).
-
Install the gems. Run
bundle install
-
Create an
.env
file. There is an example file, you'll need to add your screen name, app key/secret, and oauth token for your account. -
Bootstrap the application. Run a couple of Rake commands:
rake import:user rake import:all
First it hits the Twitter API to grab info about the user. Then it attempts to pull down all the tweets available via the Twitter API.
-
(Optional) If you have any saved tweets, you can import them locally. Create a
backup
directory at the project root. Include any xml or json files that represent the output of theuser_timeline
API method. Again, you only need to do this if you have saved tweets that fall outside the 3200 maximum. The last 3200 were imported directly from Twitter via the previous step.An easy way to backup your tweets is via a web browser directly from Twitter. Go to the following URL and save the output. Just insert your screen name and change
page=1
topage=2
, etc. up topage=16
to grab 3200 tweets (200 is the max per request).The import task assumes json. If you have xml files, run the following rake task first, which will create json files in the same directory (it won't overwrite the xml):
rake convert_xml_backup_to_json
Then import the saved tweets by running:
rake import:saved
-
Boot the app by entering the following in a terminal:
bundle exec foreman start
The Twitter API only exposes the last 3200 tweets, so if you have more than that, you're pretty much screwed. However, if you had the foresight to backup the XML/JSON before hitting 3200 tweets, then you can use the included Rake task to import them.
Give it a go and let me know how it works out. Follow @tweetdenapp for updates and for support. You can also follow @philoye if you're so inclined.
Copyright (c) 2010 Phil Oye
TweetDen is covered by the MIT License. See LICENSE for more information.