gpt4 book ai didi

javascript - 如何获取热门帖子的 Dribbble feed?

转载 作者:行者123 更新时间:2023-11-27 22:37:20 25 4
gpt4 key购买 nike

我试图在网站上提供 Dribbble feed,其中包含最新的热门帖子。我不确定是否应该通过以下方式注册申请:https://dribbble.com/account/applications/new或者我可以使用 JSON 或 AJAX 来提取 Dribbble 上发布的最新镜头吗?

我已经尝试过这个,但没有成功。我收到错误:

错误:

GET https://api.dribbble.com/shots/popular?callback=jQuery111104258300690995278_1471442725999&_=1471442726000 404 (Not Found)

JS:

$.getJSON("http://api.dribbble.com/shots/popular?callback=?", function(data) {
console.log(data);
$('.dribbble-feed').append('<img src="' + data.shots[0].image_url + '" />');
});

演示:http://codepen.io/anon/pen/YWgLaR?editors=1111

更新

按照 Karol Klepacki 给出的答复后,我在将数据记录到控制台时收到以下信息:

enter image description here

更新了 JS:

$.getJSON("https://api.dribbble.com/v1/shots/popular?callback=?", function(data) {
console.log(data);
$('.dribbble-feed').append('<img src="' + data.shots[0].image_url + '" />');
});

最佳答案

dribble api 的正确地址是https://api.dribbble.com/v1/shots

现在您必须验证自己的身份。你必须register application ,您可能会得到一些 token ,您必须将其附加到您的请求中(方法 2 from here 对您来说应该更容易。然后您将收到类似 https://api.dribbble.com/v1 的请求/shots/?access_token=TOKEN

$(document).ready(function() {

$.getJSON("https://api.dribbble.com/v1/shots/?access_token=TOKEN", function(data) {
data.forEach(function(e){
$('.dribbble-feed').append('<img src="' + e.images.normal + '" />');
})
});
});

关于javascript - 如何获取热门帖子的 Dribbble feed?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38999207/

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