如何使用Google相册API获取所有用户照片?(How do I get all user photos using the Google Photos API?)

编程入门 行业动态 更新时间:2024-10-14 18:13:43
如何使用Google相册API获取所有用户照片?(How do I get all user photos using the Google Photos API?)

我正在使用Picasa网络相册数据API访问我的Google相册帐户。 我的目标是在给定的开始和结束时间之间下载所有照片(旧假期照片)。 此API不支持服务器端时间过滤,因此我尝试访问最近4000个图像的元数据,并在客户端按时间过滤它们。 我有一个工作的概念证明,但我只能让服务器返回~900个图像参考(我的Google照片帐户很容易有40k的总图像)。 是否有一些我缺少的API方法让我为我的用户下载整个“提要”,以便我可以访问我所有照片上的元数据? 这是我试过的......

# 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

相册的API可以正常工作以列出所有图像 - “自动备份”相册(从Android手机上的Google相机接收图像)有30k图像,我可以查询它们的元数据。

不幸的是,我无法将这些图像放入一张专辑并以这种方式下载 - 用户创建的专辑限制为2000张图像。 (我知道这次旅行总共有大约3000张图片,因为我可以在网络界面中“选择”它们并查看总数,但你不能一次下载那么多,而且你不能在一张专辑中添加超过2k的数据。)

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.)

最满意答案

从未让API按照我的意愿工作,但我能够通过使用Google Takeout下载目标日期来“解决”这个问题

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

更多推荐

本文发布于:2023-08-07 02:53:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1459412.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   照片   用户   相册   Google

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!