Tweetback
Take ownership of your Twitter data and get your tweets back
Install / Use
/learn @tweetback/TweetbackREADME
tweetback Twitter Archive
Take ownership of your Twitter data. First talked about at Jamstack Conf 2019 and in this blog post.
- Referenced on Delete Twitter!
Demos
- https://www.zachleat.com/twitter/
- https://twitter.11ty.dev/
Features
- Built with Eleventy
- Each tweet has its own independent URL (with backwards/forwards threading!)
- Uses
@tweetback/canonicalto resolve other Twitter archives URLs (internal links stay in the archive and don’t link out to Twitter). t.colinks are bypassed and original hyperlinks URLs are used.- Links to users, tweets, non-truncated URLs.
- Nicer link formatting for links-to-tweets: @username/:id.
- Support some markdown: I sometimes use
backtickmarkdown notation for code in my tweet text. This translates to<code>properly. - Analytics:
- See your most popular tweets
- Who you retweet the most
- Who you reply to the most
- Frequently used swear words
- Top emoji
- Top hashtags
Usage
- Clone/download this repository
- In your terminal,
cdto the folder of the project - Install Node.js
- Run
npm install
Populate the database from your Twitter Archive zip
- Copy
./data/tweets.jsfrom your Twitter Archivezipfile into the./databasedirectory of this project.- Rename
window.YTD.tweet.part0intweets.jstomodule.exports
- Rename
- If you want to exclude Twitter Circles tweets (these are included in the archive, why 😭): copy
./data/twitter-circle-tweet.jsfrom your Twitter Archivezipfile into the./databasedirectory of this project.- Rename
window.YTD.tweet.part0intwitter-circle-tweet.jstomodule.exports
- Rename
- Run
npm run importornpm run import-without-circles
Build the web site
- Edit the
_data/metadata.jsfile to add metadata information. - Run
npm run build(will just create the proper files) ornpm start(will run a server to look at them in your browser).- Optional: If you want the web site to live in a subdirectory (e.g.
/twitter/), use Eleventy’s Path Prefix feature via the command line--pathprefix=twitteror via a return object in your configuration file. Careful: this is an option to Eleventy and not npm, so it needs to live after a--separator (for instance,npm run build -- --pathprefix=twitter).
- Optional: If you want the web site to live in a subdirectory (e.g.
⚠️ Warning: the first build may take quite a long time (depending on the size of your archive), as remote media is fetched/downloaded into your project locally. Repeat builds will be much faster.
Fetch additional tweets from the API (optional)
If you want to fetch additional tweets from the API and put them into your sqlite database:
- You will need a twitter developer token an a
TWITTER_BEARER_TOKENenvironment variable (from the Twitter API v2). Read more about App-only Bearer Tokens. - Run
npm run fetch-new-data
Add your production URL to @tweetback/canonical (optional)
https://github.com/tweetback/tweetback-canonical has a mapping.js file that stores the existing twitter username => canonical URL mappings. These will be transformed automatically to point to other archives in all tweetback instances.
Publish your archive (optional)
- To GitHub Pages
