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

https://github.com/tsubasaogawa/flickr-s3-sync-in-blog

flickr-s3-sync-in-blog helps you migrate from Flickr.
https://github.com/tsubasaogawa/flickr-s3-sync-in-blog

aws-s3 flickr migration

Last synced: 2 months ago
JSON representation

flickr-s3-sync-in-blog helps you migrate from Flickr.

Awesome Lists containing this project

README

        

# flickr-s3-sync-in-blog (fssync)

flickr-s3-sync-in-blog helps you migrate from Flickr.

## Features

- Copy images in the blog post from Flickr to S3
- Replace Flickr URLs with S3 URLs in the blog post
- Remove some tags and attributes used by Flickr, such as `data-flickr-embed`, `client-code.js`

### For example

Before

```html


twilight

```

Run `fssync`

```bash
./fssync -config=fssync.toml /home/ipsum/entry/2024/04/24/123456.md

2024/04/24 22:16:26 Load: /home/ipsum/entry/2024/04/24/123456.md
2024/04/24 22:16:27 Upload: 56789_123abc456def_c.jpg
2024/04/24 22:16:27 Backup: /home/ipsum/blog_backups/2024/04/24/123456.md.bak
2024/04/24 22:16:27 Save: /home/ipsum/entry/2024/04/24/123456.md
```

After

```html

twilight

```

```bash
aws s3 ls s3://your.s3bucket.com/56789_123abc456def_c.jpg
# -> File exists
```

## Install

Download the binary from the [release](https://github.com/tsubasaogawa/flickr-s3-sync-in-blog/releases) page.

## Configuration

Open and edit `fssync.toml`.

## Usage

```bash
./fssync -config=fssync.toml -dryrun=true
```

`fssync` with dryrun mode will not upload an image or modify a blog file. It outputs replaced blog texts to stdout.

After your check, you can run it without dryrun option.

```bash
./fssync -config=fssync.toml
```

## Tips

### Run fssync to multiple blog posts

`find` is useful.

```bash
find -name '*.md' -type f -print0 | xargs -0 -n1 ./fssync -config=fssync.toml
```

### For hatenablog using [blogsync](https://github.com/x-motemen/blogsync)

```bash
# Pull all blog posts
blogsync pull

# Run fssync with dryrun mode
cd
./fssync -config=fssync.toml -dryrun=true

# Run fssync for all posts in 2024
find -wholename '**/2024/*.md' -type f -print0 | xargs -0 -n1 ./fssync -config=fssync.toml

# Push modified blog posts (in 5 minutes)
find -name '*.md' -mmin -5 -type f -print0 | xargs -0 -n1 blogsync push
```