简体   繁体   English

Instagram API:是否可以从特定日期获取带标签的照片?

[英]Instagram API: Is it possible to get a tagged photo from a certain date?

I'd like to get one photo with a certain tag from each day of the year. 我想从一年中的每一天获得带有特定标签的一张照片。 I know it's easy to fetch photos of a certain tag, but I haven't found a way to get just one from a certain date. 我知道获取某个标签的照片很容易,但我还没有办法从某个日期获得一个标签。 Is this possible? 这可能吗?

Cheers, Ryan 干杯,瑞恩

They don't appear to give you that combination of parameters in a single endpoint. 它们似乎没有在单个端点中为您提供参数组合。 One approach might be to fetch images from the tags/tag-name endpoint and filter them client-side with the timestamps that are returned with the rest of the response. 一种方法可能是从tags/tag-name端点获取图像,并使用与响应的其余部分一起返回的时间戳对客户端进行过滤。 But whether you get a match depends if there's an image with the timestamp you're looking for--which in the case of January 1 to December 31, isn't likely. 但是,你是否得到一个匹配取决于是否有一个图像与你正在寻找的时间戳 - 在1月1日至12月31日的情况下,不太可能。

GET /tags/tag-name/ GET / tags / tag-name /

http://instagram.com/developer/endpoints/tags/ http://instagram.com/developer/endpoints/tags/

https://api.instagram.com/v1/tags/nofilter?access_token=ACCESS-TOKEN

GET /media/search/ GET / media / search /

For a proper date query, you could use the Instagram API's media/search endpoint and filter by timestamp. 对于正确的日期查询,您可以使用Instagram API的media/search端点并按时间戳过滤。 Perhaps the image response will come back with tags, and you can filter by those client-side? 也许图像响应会带有标签,您可以通过客户端进行过滤吗?

http://instagram.com/developer/endpoints/media/ http://instagram.com/developer/endpoints/media/

"Search for media in a given area. The default time span is set to 5 days. The time span must not exceed 7 days. Defaults time stamps cover the last 5 days. Can return mix of image and video types." “搜索给定区域中的媒体。默认时间跨度设置为5天。时间跨度不得超过7天。默认时间戳覆盖最近5天。可以返回图像和视频类型的混合。”

MIN_TIMESTAMP A unix timestamp. MIN_TIMESTAMP一个unix时间戳。 All media returned will be taken later than this timestamp. 返回的所有媒体都将晚于此时间戳。

MAX_TIMESTAMP A unix timestamp. MAX_TIMESTAMP一个unix时间戳。 All media returned will be taken earlier than this timestamp. 返回的所有媒体都将早于此时间戳。

https://api.instagram.com/v1/media/search?min_timestamp=XXXXXX&max_timestamp=XXXXXXX&access_token=ACCESS-TOKEN

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM