Flickr API 有问题。简而言之,我有一个运行良好的签名呼叫,但我需要为其添加一个回调。添加&callback=?
到字符串会导致 API 返回jsonFlickrApi({"stat":"fail", "code":96, "message":"Invalid signature"})
所以我不确定如何最好地处理它。通话需要签名,因为它正在抓取私人照片。有没有办法构造我的回调函数来避免这个问题?我一直将回调放在格式参数之后,并尝试在字符串的末尾。两者都返回相同的错误。我放错地方了吗?
谢谢你的帮助!
jsFiddle:http://jsfiddle.net/danielredwood/RzkzY/14/
function imgBuilder(data){
$.each(data.photos.photo,function(i,rPhoto){
var base = 'http://farm' + rPhoto.farm + '.static.flickr.com/' + rPhoto.server + '/' + rPhoto.id + '_' + rPhoto.secret,
thumb = base + '_m.jpg',
medium = base + '.jpg',
large = base + '_b.jpg',
imageM = '<a class="fancybox" rel="group" ' + 'title="' + rPhoto.title + '" href="'+ medium +'"><img src="' + thumb + '" alt="' + rPhoto.title + '"/></a>',
imageL = '<a class="fancybox" rel="group" ' + 'title="' + rPhoto.title + '" href="'+ large +'"><img src="' + thumb + '" alt="' + rPhoto.title + '"/></a>';
$(imageM).appendTo("#test");
});
}
/* Need to add callback to the string?? */
$.getJSON("http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=e3571d0891d2ad7f6b2b44611b8126ee&user_id=26545877%40N04&tags=terminal+5&per_page=25&format=json&auth_token=72157629563488548-bdcd1a2ad2f288df&api_sig=944625b8e72de2b3b9200a892263e1b1", imgBuilder);