A simple script for backuping photos from Flickr account.
yandex-s3
- Yandex Cloud S3file
- Local file system
- Does not upload already uploaded photos. So, the script checks uploaded photos and starts uploading only new ones.
- Show dubbed photos in a photoset.
Create secrets.json
:
{
"flickr": {
"consumerKey": "",
"consumerSecret": "",
"oauthToken": "",
"oauthTokenSecret": ""
},
"s3": {
"region": "ru-central1",
"endpoint": "https://storage.yandexcloud.net",
"bucket": "",
"credentials": {
"accessKeyId": "",
"secretAccessKey": ""
}
}
}
$ git clone https://github.com/flickr/flickr-sdk.git
$ cd flickr-sdk
$ nvm use 18
$ npm install && npm run build
$ cd examples
$ openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=CommonNameOrHostname"
$ FLICKR_CONSUMER_KEY=<YOUR_APIKEY> FLICKR_CONSUMER_SECRET=<YOUR_SECRET> node oauth.mjs
Save credentials to secrets.json
:
{
"flickr": {
"consumerKey": "",
"consumerSecret": "",
"oauthToken": "",
"oauthTokenSecret": ""
}
}
- Create S3 bucket.
- Do some preparation.
- Append the following section to your
secrets.json
:
{
"s3": {
"region": "ru-central1",
"endpoint": "https://storage.yandexcloud.net",
"bucket": "",
"credentials": {
"accessKeyId": "",
"secretAccessKey": ""
}
}
}
$ git clone [email protected]:tarmolov/flickr-backup.git
$ cd flickr-backup
$ npm install
$ npm start # upload photos to s3
$ BACKUP_STRATEGY=file npm start # download photos locally
$ DEBUG=1 npm start # show debug information
$ USE_CACHE=1 npm start # use cache for flickr responses
$ FILTER_PHOTOSETS="<photoset title>" BACKUP_STRATEGY=file npm start
$ mkdir flickr-photoset
$ REGION=ru-central1 AWS_ACCESS_KEY_ID=<accessKeyId> AWS_SECRET_ACCESS_KEY=<secretAccessKey> aws s3 sync --endpoint-url https://storage.yandexcloud.net "s3://<bucket>/<photoset title>" flickr-photoset