Code Monkey home page Code Monkey logo

flickr-backup's Introduction

Flickr backup

A simple script for backuping photos from Flickr account.

Available backup destinations

  • yandex-s3 - Yandex Cloud S3
  • file - Local file system

Features

  • Does not upload already uploaded photos. So, the script checks uploaded photos and starts uploading only new ones.
  • Show dubbed photos in a photoset.

Prerequisites

Create secrets.json:

{
    "flickr": {
        "consumerKey": "",
        "consumerSecret": "",
        "oauthToken": "",
        "oauthTokenSecret": ""
    },
    "s3": {
        "region": "ru-central1",
        "endpoint": "https://storage.yandexcloud.net",
        "bucket": "",
        "credentials": {
            "accessKeyId": "",
            "secretAccessKey": ""
        }
    }
}

1. Obtain Flickr Credentials

Apply for API key and

$ 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": ""
    }
}

2. Obtain Yandex Cloud S3 Credentials

  1. Create S3 bucket.
  2. Do some preparation.
  3. Append the following section to your secrets.json:
{
    "s3": {
        "region": "ru-central1",
        "endpoint": "https://storage.yandexcloud.net",
        "bucket": "",
        "credentials": {
            "accessKeyId": "",
            "secretAccessKey": ""
        }
    }
}

Quick start

$ 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

Howto

Backup a single photoset from Flickr

$ FILTER_PHOTOSETS="<photoset title>" BACKUP_STRATEGY=file npm start

Download a single photoset from s3

$ 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

flickr-backup's People

Contributors

tarmolov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.