gpt4 book ai didi

javascript - 查询 flickr api

转载 作者:行者123 更新时间:2023-11-28 01:32:12 25 4
gpt4 key购买 nike

我试图从 flickr 获取随机公共(public)图像,但出现错误,并且不知道为什么?这是一个非常简单的查询,但似乎有问题:

    $.ajax({
url: 'http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=my_super_secret_key&tags=Netherlands&per_page=3&format=json',
type: "GET",
dataType: "json",
success: function (data) {
console.log("flickr");
console.log(data);
},
error: function(xhr, status, error) {
console.log("Error flickr");
var err = ("(" + xhr.responseText + ")");
console.log(err);
console.log(status);
console.log(error);
}
});

当然是填写了 super 秘钥,所以这不是错误:)

错误响应是:

Error flickr (index):81 (jsonFlickrApi({"photos":{"page":1, "pages":680998, "perpage":3, "total":"2042994", "photo":[{"id":"12743757394", "owner":"95983323@N05", "secret":"6e8229d323", "server":"3736", "farm":4, "title":"Gorinchem", "ispublic":1, "isfriend":0, "isfamily":0}, {"id":"12743426273", "owner":"41159332@N02", "secret":"de25f48cf9", "server":"2867", "farm":3, "title":"Little beauty", "ispublic":1, "isfriend":0, "isfamily":0}, {"id":"12743767144", "owner":"93254204@N00", "secret":"43f58e5635", "server":"2824", "farm":3, "title":"...Of AmsterSam", "ispublic":1, "isfriend":0, "isfamily":0}]}, "stat":"ok"})) (index):83 parsererror (index):84 SyntaxError {stack: (...), message: "Unexpected token j"}

更新:

确定需要传递参数

nojsoncallback=1 but is it only possible to get thumbnails from the response?

最佳答案

您似乎只是忘记添加 api_key,因此您的网址应该是

    url: 'http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key='+my_super_secret_key+'&tags=Netherlands&per_page=3&format=json'

我刚刚检查了包含我的 api_key 的 url,一切顺利。

关于javascript - 查询 flickr api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21985482/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com