Search code examples
apigdatagoogle-data-apigoogle-photos

How do I get all user photos using the Google Photos API?


I'm using the Picasa Web Albums Data API to access my Google Photos account. My goal is to download all photos between a given start and end time (old vacation pics). This API doesn't support server-side time filtering, so I'm trying to access the meta-data of the most recent 4000 images and filter them by time client-side. I have a working proof of concept, but I can only get the server to return ~900 image references (my Google Photos account easily has 40k total images). Is there some API method I am missing that lets me download the entire "feed" for my user so I can access meta-data on all my photos? Here is what I've tried...

# Tried this first, got ~900 results
pics = gd_client.GetUserFeed(kind='photo', limit=4000).entry
# Tried using the paging parameter start-index, but even if I 
# page through until it errors out, there are only ~900 results
pics = gd_client.GetFeed('/data/feed/api/user/default?kind=photo&max-results=100&start-index=500').entry

The APIs for albums do work correctly to list all images - the 'Auto Backup' album (that receives images from Google Photos on Android phones) has 30k images and I can query the meta data of them all.

Unfortunately I cannot put these images into one album and download them that way - user-created albums are limited to 2000 images. (I know there are around 3000 total images from this trip, because I can 'select' them in the web interface and see the total count, but you cannot download that many at once and you cannot add more than 2k to one album.)


Solution

  • Never got API to work as I'd desired, but I was able to "solve" this by downloading the target dates using Google Takeout