问题
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 of every single photo uploaded on Google Photos.
I can't use Picasa for a long term project, G Drive API does not find all the photos, G+ can't find all the photos
Please, help me find a solution O.o It can be Javascript-based, or curl-based, I'll translate it.
Thanks in advance!
UPDATE
I've found https://github.com/howdy39/google-picker-api-demo which lets me get all my photos inside an album. It's something, but I hope Google will release better Google Photos API soon. :)
回答1:
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.
回答2:
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.
回答3:
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
}
来源:https://stackoverflow.com/questions/44006232/google-photos-api-import-all-my-photos