cooljeanius / tweetback

Take ownership of your Twitter data and get your tweets back
https://cooljeanius.github.io/tweetback/
MIT License
2 stars 0 forks source link
11ty indieweb tweetback tweets twitter twitter-archive twitter-data

tweetback Twitter Archive

Take ownership of your Twitter data. First talked about at Jamstack Conf 2019 and in this blog post.

Demos

Features

Usage

Populate the database from your Twitter Archive zip

  1. Copy ./data/tweets.js from your Twitter Archive zip file into the ./database directory of this project.
    • Rename window.YTD.tweet.part0 in tweets.js to module.exports
  2. If you want to exclude Twitter Circles tweets (these are included in the archive, why 😭): copy ./data/twitter-circle-tweet.js from your Twitter Archive zip file into the ./database directory of this project.
    • Rename window.YTD.tweets.part0 in twitter-circle-tweet.js to module.exports
  3. Run npm run import or npm run import-without-circles

Build the web site

  1. Edit the _data/metadata.js file to add metadata information.
  2. Run npm run build (will just create the proper files) or npm 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=twitter or 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).

⚠️ 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:

  1. You will need a twitter developer token an a TWITTER_BEARER_TOKEN environment variable (from the Twitter API v2). Read more about App-only Bearer Tokens.
  2. 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)