Flickr API返回重复的照片 [英] Flickr API returning duplicate photos

查看:72
本文介绍了Flickr API返回重复的照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在flickr API上遇到了一个令人困惑的问题.

I've come across a confusing issue with the flickr API.

当我进行照片搜索(flickr.photos.search)并请求较高的页码时,我 通常会获得返回的不同页码的重复照片. 这是三个网址,它们每个都应返回三组不同的图像, 但是,他们-奇怪的是-返回相同的图像:

When I do a photo search (flickr.photos.search) and request high page numbers, I often get duplicate photos returned for different page numbers. Here's three URLs, they should each return three sets of different images, however, they - bizarrely - return the same images:

http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=ca3035f67faa0fcc72b74cf6e396e6a7&tags=gizmo&tag_mode=all&per_page=3&page=6820
http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=ca3035f67faa0fcc72b74cf6e396e6a7&tags=gizmo&tag_mode=all&per_page=3&page=6821
http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=ca3035f67faa0fcc72b74cf6e396e6a7&tags=gizmo&tag_mode=all&per_page=3&page=6822

还有其他人遇到吗? 我似乎能够在任何标签搜索中重新创建它.

Has anyone else come across this? I seem to be able to recreate this on any tag search.

干杯.

推荐答案

可以从flickr检索4000多个图像;您的查询必须按(例如)时间范围进行分页,以使该查询中的图像总数不超过4000.您还可以使用其他参数(例如边界框)来限制响应中的图像总数.

It is possible to retrieve more than 4000 images from flickr; your query has to be paginated by (for example) temporal range such that the total number of images from that query is not more than 4000. You can also use other parameters such as bounding box to limit the total number of images in the response.

例如,如果您使用标签"dogs"进行搜索,则可以执行此操作(在时间范围内进行二进制搜索):

For example, if you are searching with the tag 'dogs', this is what you can do ( binary search over time range):

  1. 在请求网址中指定最小日期和最大日期,例如1990年1月1日和2015年1月1日.
  2. 检查响应中的图像总数.如果大于4000,则将时间范围一分为二并处理前半部分,直到从查询中获得的图像少于4000张为止.一旦获得该信息,请请求该时间范围内的所有页面,然后移至下一个间隔并执行相同的操作,直到(a)满足所需图像数量(b)在整个初始时间间隔内进行搜索.

这篇关于Flickr API返回重复的照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆