Google Drive to Google Photos Direct Transfer Using RedHat Openshift

Google Introduced Photos with unlimited storage and lot of Artificial Intelligent.

People want to utilize the unlimited storage by moving images from Google Drive to Photos , but as of today there is no direct way to transfer over the internet without downloading images to user PC.

As Google Photos doesn’t provide an API , I have been Reverse — Engineering the Google Photos Web Upload and come with a python program to Directly move all images from Google Drive to Google Photos.

For Direct Online Transfer ,this method utilizes the RedHat Openshift PaaS free account which would be enough for this simple task.

Description

Google Drive — Using the Drive API

Google Photos — Doesn’t provide an API till date and this method is based on reverse-engineering the Google Photos Web Upload.

Hence for this to work ,the cookie of your drive account is needed and few details mentioned in INPUTS.json file.

  1. cookie — Cookie of google photos account to which you wish to transfer photos
  2. clientInfo — Supplied by the google photo web upload to the google server
  3. effective_id — Denotes owner of the file on drive — owner_id

This script will Download all images from Google Drive and uploads to Google Photos over the internet on the Openshift PaaS

Requirements

Google Drive API — Enabled for your account

  1. Python 2.7 or later — This is based on 2.7
  2. Git on windows/Linux.
  3. Openshift Free Account with rhc command-line tools installed.

Installation

python setup.py install

Usage

Fork and clone a copy of this git repository Google-Drive-2-Photos

Getting the Required info for the first time.

Make Sure you got the Google DRIVE API Enabled and Downloaded the client_secret.json file to the git repository.

  1. Open you Firefox browser and go to page photos.google.com and sign-in to your account
  2. Open the Firefox Dev Tools [Right click — Select ->Inspect Elements (or) Press “Q” from Keyboard]
  3. Go to the Network tab of Dev Tools
  4. Upload a sample image by dragging it over the browser window.
  5. In Network tab watch for a POST request “resumable?authuser=0”

Save changes to INPUT.json and update the repository

Finally run the following in (cmd/terminal):

python app.py
Obtain the Google Drive OAuth Credentials which will be saved in .credentials folder. After a few initial successful uploads (Wonderful ! it works) press Ctrl+c to stop the program. Now we can upload the script to Openshift.

Using Openshift Hosting

  • Create a Free account
  • Getting Started with OpenShift Online
  • Create a New Python App in the web console and during creation provide your git repository url (or) later Upload the git repository using “rhc command line” tool
  • In the cmd/terminal type “rhc tail -a YOUR_Openshift_APP_NAME “ to view your logs
  • Go to Google Photos to view currently transferred files.

Credits

Jagadeesan : myscoreisone@gmail.com

Bugs and Improvements

Make a Pull request / file an issue.

License

The MIT License (MIT) Copyright (c) 2016 Jagadeesan