Picasa web albums - impossible to list all photos
Asked Answered
B

0

12

I've uploaded about 40k photos using the Google Photos uploader tool, and now I'm trying to get a list of those photos using the Picasa Web Albums Data API (as there is no separate Google Photos API that I'm aware of).

So far, it appears impossible to get a complete list of all of the photos because you can list only 1000 photos at a time and then use the start-index parameter to do paging, but the server returns an error once you use a start-index above 11000. With a start-index of 11000 this occurs:

gdata.photos.service.GooglePhotosException: (500, 'Internal Server Error', 'Deprecated offset is too large for a stream ID query. Please switch to using resume tokens.')

(I'm using Python, but have confirmed that the error is independent of the language library)

I'd be happy to switch to using "resume tokens" like the error indicates... except that they are not mentioned in any documentation that I could find.

This is an authenticated request and the URL I'm using looks like this:

https://picasaweb.google.com/data/feed/api/user/[myUserID]/albumid/[myAlbumID]?kind=photo&max-results=1000&start-index=11000

Can anyone show me an example request using resume tokens or point me to documentation on them? Or, if anyone knows of some other way to get a complete list of all of the photos in a large album, that'd be great too. Thanks!

EDIT: the problem happens in any language, but in Python you can reproduce it consistently with:

startIndex = 1
while 1:
    print '(fetching more photos)'
    photos = client.GetFeed(ALBUM_URL, limit=1000, start_index=startIndex)
    for photo in photos.entry:
        print 'startIndex:', startIndex
        startIndex += 1

where ALBUM_URL is like the URL I listed above and client is an authenticated instance of gdata.photos.service.PhotosService.

Bibber answered 8/1, 2017 at 2:57 Comment(6)
Do you have any code to share?Gneiss
Added, although the URL is highly user- and album-specific, and the code for getting an authenticated client depends on how the app is configured with Google and also requires you download and set up credentials, so I omitted all of that.Bibber
Just run in to this myself. The error message is truly bizarre. What on earth is a "stream ID query"? I can't see any reference to this anywhere else. And look at the second sentence, it reads Please switch to using resume tokens., two spaces between "Please" and "switch". It's as though the wrong message accidentally got pasted in.Fredette
Dave, did you find a way to overcome this? I am facing the same problem right now.Mohammadmohammed
No, it turns out that the Picasa API is broken in this way and in several others. However in the past few weeks it looks like Google released a new Photos API. Haven't tried it out yet, but maybe it works. See developers.google.com/photos for details.Bibber
Do you know if I have to ask for user authorization again? Or the authorization granted before for Picasa will also work with Google Photos?Mohammadmohammed

© 2022 - 2024 — McMap. All rights reserved.