Skip to content

ckolderup/static-tweets

Repository files navigation

Static Tweets allows you to back up the content of tweets (text + images + associated metadata) to an HTML file that you can keep for your personal reference.

It's a command-line tool written in Ruby and requires Rubygems and Bundler. Rbenv or a tool that uses the .ruby-version file is recommended to ensure ruby version compatibility.

In order to use the tool, you'll first need to generate an 'application' on the Twitter Application Management page (https://apps.twitter.com/) and put your OAuth keys into a .env file in the root of your locally cloned repo. The following key/value pairs are required:

TWITTER_CONSUMER_KEY=...
TWITTER_CONSUMER_SECRET=...
TWITTER_ACCESS_TOKEN=...
TWITTER_ACCESS_TOKEN_SECRET=...

You can optionally add the following key/value pairs in order to enable certain features:

STORIFY_API_KEY=...

There are a number of commands you can then use to download your tweet backup, depending on the source you want to use:

./from_url.sh <url>
./from_storify.sh <url>
./from_file.sh <text_file>

The result is a directory named to match the supplied text filename. Inside the directory is a JSON file with each tweet's full data as supplied by Twitter, corresponding images for any tweets that include media, and an index.html file that shows you the tweets in an embed-like view.

Please note that some websites have fancy features like infinite scroll that may hide a bunch of tweets from being displayed until a user interacts with the page in some way. If a page works this way, the command that takes a single URL will not work reliably and you'll have to compile a list of tweet ids in a file manually or via some other method. (This includes Storify URLs; use the from_storify command for those)

If for some reason you want to run the command on the same text file twice, you'll need to delete the directory before running again.

About

Save content from list of tweet URLs to an HTML file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published