Instagram API媒体/搜索/端点返回的结果超出时间范围 [英] Instagram API media/search/ endpoint return results outside the time range

查看:70
本文介绍了Instagram API媒体/搜索/端点返回的结果超出时间范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用以下示例配置来使用Instagram API媒体/搜索端点:

I'm currently using Instagram API media/search endpoint using this following sample configuration:

curl -XGET 'https://api.instagram.com/v1/media/search?
lat=1.3058866783157643&lng=103.88191223144531&distance=5000&
min_timestamp=1394615197&max_timestamp=1394615227&
access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

此命令的重点是:

  1. min_timestamp = 1394615197
  2. max_timestamp = 1394615227

我获得的结果具有以下created_time字段:(我不放入原始结果,因为它会占用大量空间.我使用jq(

The results that I obtained has these following created_time field: (I don't put the raw result because it will consume lots of space. I use jq (http://stedolan.github.io/jq/) to extract the created_time field).

  1. "1394615279" *外部时间戳记参数
  2. "1394615277" *
  3. "1394615270" *
  4. "1394615268" *
  5. "1394615251" *
  6. "1394615248" *
  7. "1394615246" *
  8. "1394615243" *
  9. "1394615241" *
  10. "1394615239" *
  11. "1394615232" *
  12. "1394615217"
  13. "1394615214"
  14. "1394615204" *
  15. "1394615204" *
  16. "1394615187" *
  17. "1394615180" *
  18. "1394615180" *
  19. "1394615179" *
  20. "1394615178" *
  1. "1394615279" *outside timestamp parameters
  2. "1394615277" *
  3. "1394615270" *
  4. "1394615268" *
  5. "1394615251" *
  6. "1394615248" *
  7. "1394615246" *
  8. "1394615243" *
  9. "1394615241" *
  10. "1394615239" *
  11. "1394615232" *
  12. "1394615217"
  13. "1394615214"
  14. "1394615204" *
  15. "1394615204" *
  16. "1394615187" *
  17. "1394615180" *
  18. "1394615180" *
  19. "1394615179" *
  20. "1394615178" *

如您所见,在我使用的时间戳参数之外创建了一些结果(我在后面加上星号).那么,这是媒体搜索API的预期行为吗?还是因为我的时间戳参数出了点问题(范围太小了,请注意最大时间戳和最小时间戳之间的时差只有30秒).

As you can see there are results (I put an asterisk behind) that created outside the timestamp parameters that I use. So, is this the expected behavior of the media search API? Or is it because something wrong with my timestamp parameter (range too close maybe, note that the difference between max and min timestamp is only 30 seconds).

推荐答案

我认为Instagram将时间限制舍入到最接近的分钟.四舍五入为最小,最大为四舍五入.因此,查询中的时间范围跨度为两分钟.因此,您的查询窗口实际上是120秒.您必须自己过滤掉额外内容.

I believe that Instagram rounds time constraints to the nearest minute. Rounding down for min and up for max. So the time ranges in your query spans two minutes. So, your query window is actually 120 seconds. You'll have to filter out the extras yourself.

请记住,媒体搜索将最多返回20个结果.因此,您可能希望针对该60秒内的每个窗口将该查询分为两个单独的查询.我认为媒体搜索结果不会使用分页显示其他结果.因此,您真的不知道丢失了多少数据.

Keep in mind that the media search is going to return a maximum of 20 results. So you may want to split that query up in to two separate queries for each of the 60 second windows it spans. I don't think media search results use pagination to display additional results. So you don't really know how much data you're losing.

这篇关于Instagram API媒体/搜索/端点返回的结果超出时间范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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