Google Photos API import all my photos

左心房为你撑大大i 提交于 2019-12-03 11:16:11

There is currently no other/similar/better API (by Google) that interacts with Google Photos like Picasa Web Albums Data API does.

Other than the alternatives you've already mentioned, unfortunately, I don't think there's an API out there that has the functions that is (even remotely) similar to what you're looking for.

With all that said, questions asking for software libraries or tutorials and whatnot are considered off-topic here in Stack Overflow.

PS: The request for an official API by a lot of devs is expressed (and hopefully heard by Google) in a lot of sites for quite some time (like this one). Belive me. (sigh) I understand the frustration.

May 8, 2018: Good news! Google just have launched Google Photo API on Googel I/O

You can get list of all your media, including albums. Moreover, API allows you to upload and share media. At the moment it is in Developer Preview state and has quota limit:

During the developer preview, the quota for requests to the Google Photos Library API is 2,500 requests per project per day. Requests to access media bytes (like loading a photo or video) aren't counted against the limit.

Use the Search call, (https://developers.google.com/photos/library/reference/rest/v1/mediaItems/search) with an empty search string, retrieves all media items.

I have recently built a tool to backup all my photos (https://github.com/dtylman/gitmoo-goog), following is an example in golang to list the entire library:

import "google.golang.org/api/photoslibrary/v1"`

func ListAll(svc *photoslibrary.Service) error {
    hasMore := true
    req := &photoslibrary.SearchMediaItemsRequest{PageSize: 50}
    for hasMore {
        items, err := svc.MediaItems.Search(req).Do()
        if err != nil {
            return err
        }
        for _, m := range items.MediaItems {
            fmt.Println(m)
        }
        req.PageToken = items.NextPageToken
        if req.PageToken == "" {
            hasMore = false
        }
    }
    return nil  
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!