/twitter-favorites-archive

Archive metadata and medias of your Twitter Favorites

Primary LanguageShellGNU Affero General Public License v3.0AGPL-3.0

Twitter Favorites(Likes) Archive

A series of scripts to archive metadata and medias of your Twitter Favorites(Likes).

Prerequisites

Twitter API

Register an App on Twitter Developer and get access credentials in the "Keys and Tokens" tab of your App's page.

Dependencies(for running locally)

Usage

Run in Docker

Setup

Rename docker/config-example.env to docker/config.env and customize it with:

  • Twitter API credentials
  • Your username
  • [optional] Cron job schedule(for "Cron job" section)
  • Other docker ENV variables.

Oneshot

docker run --rm --name=tfa --env-file=./docker/config.env -v ${PWD}/output:/app/output 15cm/twitter-favorites-archive /app/scripts/main.sh -tdmu -o /app/output -c /app/output/cache.txt

Cron job

Rename docker/docker-compose-example.yaml to docker/docker-compose.yaml and customize it with the mount point of app-output volume.

cd into docker folder and run:

docker-compose up -d

Run in local environment

Setup

Run gem install bundler && bundle install to install Ruby dependencies.

Rename src/config-example.yaml to src/config.yaml and fill it with your:

  • Twitter API credentials
  • Username

You can also run ruby src/twitter-favorites-archive.rb init [args...] to generate src/config.yaml.

Execute

  1. Run ruby src/twitter-favorites-archive.rb meta. It will dumps meta data of your favorite tweets under output/year/month/tweet_id/tweet.json.
  2. [Optional] Run scripts/00-download-all-medias.sh output. It will download all media(jpeg of photos and video thumbnail) files of tweet.json to the same folder.
  3. [Optional] Run scripts/01-update-all-medias-meta.sh output. It will fetch meta data from tweet.json and populate Exif data of the downloaded media files.

To run all the steps together with data dumped to output/, run scripts/archive.sh output

Use cases

PhotoPrism

I import the media files gathered by this project into PhotoPrism so that I can browse images of my Twitter Favorites in a more flexible way.

PhotoPrism Use Case Screenshot