This tool uses the Google Photos API to download all photos and videos to the directory of the user's choice.
My main motivation was to prevent losing all the photos of my children and family should Google ever lock me out of my account.
This tool runs on my NAS drive and runs once per day, looking back at the past N days of uploaded photos.
$ go build -o gphotobackup gphotobackup.go
- Enable Google Photos Library API: https://console.cloud.google.com/apis/library/photoslibrary.googleapis.com
- Create OAuth Client ID (application type "Desktop App")
- Download the JSON file.
On a system with a browser available:
$ gphotobackup login --creds /path/to/downloaded/credentials.json
Otherwise, use:
$ gphotobackup login --browser=false --creds /path/to/downloaded/credentials.json
$ gphotobackup print
$ gphotobackup print album --id theBigLongID
$ gphotobackup backup --albumID theBigLongID
$ gphotobackup backup --start 2021-01-01 --end 2022-01-01 --out /Volumes/GooglePhotosBackup/ --workers 5
$ gphotobackup backup --sinceDays 21