Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/15cm/twitter-favorites-archive

Archive metadata and medias of your Twitter Favorites
https://github.com/15cm/twitter-favorites-archive

Last synced: 3 months ago
JSON representation

Archive metadata and medias of your Twitter Favorites

Awesome Lists containing this project

README

        

# 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](https://developer.twitter.com/apps) and get
access credentials in the "Keys and Tokens" tab of your App's page.

### Dependencies(for running locally)
- ruby 2.7
- [jq](https://github.com/stedolan/jq)
- wget
- GNU parallel
- [fd](https://github.com/sharkdp/fd)
- [exiftool](https://github.com/exiftool/exiftool)

## 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
```sh
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](https://github.com/photoprism/photoprism) so that I can browse images of my Twitter Favorites in a more flexible way.

![PhotoPrism Use Case Screenshot](./assets/images/use-case-photoprism-0.png)