Google Photos API import all my photos

后端 未结 3 2037
轮回少年
轮回少年 2021-02-07 16:18

I\'ve been reading more or less every StackOverflow question about Google Photos, and still I haven\'t figured out the answer.

I need, for my Rails app, to get the url o

相关标签:
3条回答
  • 2021-02-07 16:55

    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  
    }
    
    0 讨论(0)
  • 2021-02-07 17:07

    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.

    0 讨论(0)
  • 2021-02-07 17:09

    Refer to the accepted answer.

    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.

    0 讨论(0)
提交回复
热议问题