【问题标题】:Picasa Web Albums API : No effect of start-index in photos feedPicasa 网络相册 API:照片提要中的 start-index 没有影响
【发布时间】:2014-10-05 12:01:11
【问题描述】:

我正在从 Picasa 获取用户 recently uploaded photos。如parameters doc. 中所述,您可以使用 max-resultsstart-index 组合对响应进行分页。但这似乎不起作用。

不同起始索引的请求示例:

https://picasaweb.google.com/data/feed/api/user/myEmailId?kind=photo&max-results=5&alt=json&start-index=1&imgmax=d

https://picasaweb.google.com/data/feed/api/user/myEmailId?kind=photo&max-results=5&alt=json&start-index=6&imgmax=d

两个请求都返回相同的结果。 start-index 没有影响。

我已在GData Issues 上发布此消息,但尚未收到任何回复。

我正在尝试的代码 sn-p:

credentials = SignedJwtAssertionCredentials(
      SERVICE_ACCOUNT_EMAIL,
      file(SERVICE_ACCOUNT_PEM_FILE_PATH, "rb").read(),
      scope=["https://picasaweb.google.com/data/"],
      prn=userEmail
    )
PHOTOS_URL = "https://picasaweb.google.com/data/feed/api/user/%s?kind=photo&max-results=5&alt=json&start-index=%s&imgmax=d"
http = httplib2.Http()
http = credentials.authorize(http)
response, albumPhotos = http.request(PHOTOS_URL %(userEmail, startIndex), 'GET')
albumPhotos = eval(albumPhotos)

有什么想法吗?

【问题讨论】:

  • 确实,现在 API 好像严重损坏了
  • Api 还是坏了(

标签: python google-api gdata picasa


【解决方案1】:

https://developers.google.com/oauthplayground 试试吧。

start-index 参数不适用于从用户https://picasaweb.google.com/data/feed/api/user/%s?kind=photo 检索最近更新的照片,尽管返回结果表明 openSearch:startIndex 确实采用了 start-index 参数。

但如果您查询特定相册中的照片,它将起作用,例如: https://picasaweb.google.com/data/feed/api/user/default/albumid/{albmId}?start-index=10

【讨论】:

  • 即便如此......您不能以这种方式下载超过 10.000 张照片。
【解决方案2】:

查找 gphoto$numphotos 值 (response['feed']['entry']['gphoto$numphotos'])。检索到可以使用的值后:

https://picasaweb.google.com/data/feed/api/user/default/albumid/{albmId}?start-index=VALUE

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多