我使用此端点工作了好几次,似乎从本周开始我传递max_id值时会抛出错误,它说:
{
"meta": {
"error_type": "APIInvalidParametersError",
"code": 400,
"error_message": "max_id must not be a media id."
}
}
我不知道在哪里可以找到api是否改变了行为,或者只是它被打破了。你们,有什么想法吗?
我发现的另一个错误是查询此端点时返回的媒体的顺序。这是一个示例数据:
#sample error
[
Media: 1220853576116214570_1383882821
Media: 1220853572180739674_233961632
Media: 1220853571106323542_44255974
Media: 1220853327487332588_16383867
Media: 1220853529276039536_37204591
Media: 1220853517236612185_1342227858
Media: 1220853478513480317_596571
Media: 1220853329006327307_299159508
Media: 1220853296836482014_1829274963
Media: 1220853282356978078_1498664215
Media: 1220853191933038656_528166155
Media: 1220481246711237359_211289081 #MEDIA INCORRECT ORDER
Media: 1220853144521663282_3026017167
Media: 1220853127735637950_619046756
Media: 1220853103550902683_2074401387
Media: 1220853106444172011_3020165605
Media: 1220449359646948005_208916789 #MEDIA INCORRECT ORDER
Media: 1220853071011680880_596571
Media: 1220852985861033044_446238634
Media: 1220852995848611111_3098675456
Media: 1220852944343050919_1126655937
Media: 1220852926209616200_327453609
Media: 1220852902671104371_351483533
Media: 1220852898165133786_207127275
Media: 1220852887618705294_1736270372
Media: 1220852850174855566_1133338201
Media: 1220852831895483805_30557620
Media: 1220851564341433250_1460935835
Media: 1220852721064734213_14247170
Media: 1220852681564341476_1329013696
Media: 1220852647186623946_2143587522
Media: 1220852634988856098_6331807
Media: 1220852621030972511_530287550
]
编辑:我刚刚检查过9天前python instagram的客户端已被弃用,并且有很多关于api行为的stackoverflow问题是从23日开始的。很多巧合
File "/usr/local/lib/python2.7/dist-packages/instagram/bind.py", line 194, in _call
return method.execute()
File "/usr/local/lib/python2.7/dist-packages/instagram/bind.py", line 186, in execute
content, next = self._do_api_request(url, method, body, headers)
File "/usr/local/lib/python2.7/dist-packages/instagram/bind.py", line 148, in _do_api_request
obj = self.root_class.object_from_dictionary(entry)
File "/usr/local/lib/python2.7/dist-packages/instagram/models.py", line 88, in object_from_dictionary
for comment in entry['comments']['data']:
KeyError: 'data'
编辑3已解决here
答案 0 :(得分:1)
您似乎将媒体ID作为分页传递。你不能再这样做了,因为Instagram改变了分页值。它曾经是媒体ID,但现在是一个字符串。
当你提出请求时,你会收到一个像这样的json:
{
pagination: {
next_max_tag_id: ...,
deprecation_warning: "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead",
next_max_id: ...,
next_min_id: ...,
min_tag_id: ...
...
},
meta: {
...
},
data: {
...
}
}
在您的请求中使用next_max_id
值max_tag_id
。这应该有效。
答案 1 :(得分:0)
直到Instagram实际响应任何人之前的解决方法是使用旧的并且已弃用next_max_tag_id
或max_tag_id
。
似乎某种方式next_max_tag_id
已在请求响应中完全消失,并被/tags/{tag-name}/media/recent?access_token={access-token}&next_max_id={next_max_id}
替换。
// Docs at http://simpleweatherjs.com
var updateWeather = function() {
$.simpleWeather({
location: '',
woeid: '1105779',
unit: 'c',
success: function(weather) {
var skycons = new Skycons({
"color": "white"
});
html = '<canvas id="weather-icon" width="128" height="128"></canvas><h2> ' + weather.temp + '°' + weather.units.temp + '</h2>';
html += '<div id="region">' + weather.city + ', ' + weather.region + '</div>';
html += '<div>' + weather.currently + '</div>';
html += '<div>' + weather.wind.direction + ' ' + weather.wind.speed + ' ' + weather.units.speed + '</div>';
html += '<div><i class="fa fa-angle-up"></i> High ' + weather.high + ' <i class="fa fa-angle-down"></i> Low ' + weather.low + '</div>'
$("#weather").html(html);
switch (parseInt(weather.code)) {
case 0:
var animation = 'sleet';
break;
case 1:
var animation = 'sleet';
break;
case 2:
var animation = 'sleet';
break;
case 3:
var animation = 'sleet';
break;
case 4:
var animation = 'sleet';
break;
case 5:
var animation = 'snow';
break;
case 6:
var animation = 'snow';
break;
case 7:
var animation = 'snow';
break;
case 8:
var animation = 'snow';
break;
case 9:
var animation = 'rain';
break;
case 10:
var animation = 'snow';
break;
case 11:
var animation = 'rain';
break;
case 12:
var animation = 'rain';
break;
case 13:
var animation = 'snow';
break;
case 14:
var animation = 'snow';
break;
case 15:
var animation = 'snow';
break;
case 16:
var animation = 'snow';
break;
case 17:
var animation = 'sleet';
break;
case 18:
var animation = 'sleet';
break;
case 19:
var animation = 'fog';
break;
case 20:
var animation = 'fog';
break;
case 21:
var animation = 'fog';
break;
case 22:
var animation = 'fog';
break;
case 23:
var animation = 'wind';
break;
case 24:
var animation = 'wind';
break;
case 25:
var animation = 'cloudy';
break;
case 26:
var animation = 'cloudy';
break;
case 27:
var animation = 'partly-cloudy-night';
break;
case 28:
var animation = 'partly-cloudy-day';
break;
case 29:
var animation = 'partly-cloudy-night';
break;
case 30:
var animation = 'partly-cloudy-day';
break;
case 31:
var animation = 'clear-night';
break;
case 32:
var animation = 'clear-day';
break;
case 33:
var animation = 'clear-night';
break;
case 34:
var animation = 'clear-day';
break;
case 35:
var animation = 'sleet';
break;
case 36:
var animation = 'clear-day';
break;
case 37:
var animation = 'sleet';
break;
case 38:
var animation = 'sleet';
break;
case 39:
var animation = 'sleet';
break;
case 40:
var animation = 'rain';
break;
case 41:
var animation = 'snow';
break;
case 42:
var animation = 'snow';
break;
case 43:
var animation = 'snow';
break;
case 44:
var animation = 'partly-cloudy-day';
break;
case 45:
var animation = 'sleet';
break;
case 46:
var animation = 'snow';
break;
case 46:
var animation = 'sleet';
break;
default:
var animation = 'clear-day';
}
skycons.remove('weather-icon')
// you can add a canvas by it's ID...
console.log(animation);
skycons.add("weather-icon", animation);
// ...or by the canvas DOM element itself.
// if you're using the Forecast API, you can also supply
// strings: "partly-cloudy-day" or "rain".
// start animation!
skycons.play();
},
error: function(error) {
$("#weather").html('<p>' + error + '</p>');
}
});
};
$(document).ready(function() {
updateWeather();
setInterval(updateWeather, 300000);
});