根据Instagram API文档,在max_timestamp
端点调用中添加/media/search
参数只应返回时间戳小于max_timestamp
(http://instagram.com/developer/endpoints/media/#get_media_search)的结果。但是,情况并非总是如此。
以下面的请求为例:
curl 'https://api.instagram.com/v1/media/search?lat=51.508515&lng=-0.12548719999995228&max_timestamp=1400700973&distance=5000&access_token=XXXXXXXXXX'
我提供的'max_timestamp'为1400700973,但是当我们查看API的结果时,我们可以看到这没有被尊重:
{
"created_time": "1400701017"
}
{
"created_time": "1400701016"
}
{
"created_time": "1400701016"
}
{
"created_time": "1400701010"
}
{
"created_time": "1400701009"
}
{
"created_time": "1400701008"
}
{
"created_time": "1400701003"
}
{
"created_time": "1400701000"
}
{
"created_time": "1400700997"
}
{
"created_time": "1400700997"
}
{
"created_time": "1400700994"
}
{
"created_time": "1400700992"
}
{
"created_time": "1400700991"
}
{
"created_time": "1400700991"
}
{
"created_time": "1400700988"
}
{
"created_time": "1400700985"
}
{
"created_time": "1400700984"
}
{
"created_time": "1400700980"
}
{
"created_time": "1400700973"
}
{
"created_time": "1400700973"
}
(我使用jq
(http://stedolan.github.io/jq/)来解析所有结果的created_times)
正如我们所看到的,所有结果实际上都在提供的max_timestamp
参数之前。这是Instagram搜索API的问题,还是我做错了什么?
答案 0 :(得分:0)
我也遇到时间戳问题,虽然我不记得确切的解决方案,但我认为您需要同时提供min_timestamp
和max_timestamp
参数,否则您会看到奇怪的结果。如果你愿意,我有机会回到这个区域的代码,我会提供更多细节,但现在就给出一个机会...
从内存中,我从最大时间戳中减去一定数量以用作min_timestamp,然后循环调用直到我获得所需数量的结果(或尝试了一定次数以避免无限循环)