我希望使用Tumblr的API和jQuery的getJson方法获取一个Tumblr博客的所有文本帖子。
我尝试使用以下代码,但只获得了20个帖子:
这是一个用于测试的不错的Tumblr博客示例: http://only-text-posts.tumblr.com/
我尝试使用以下代码,但只获得了20个帖子:
function loadPosts () {
var key = "api_key=xBcVPLfdDKpH0GjMCd1whW7rPoYkzLgZD3ZwpzndISFI4huSpA"
var api = "https://api.tumblr.com/v2/blog/only-text-posts.tumblr.com/"
var post_amount
$.getJSON(api + "info?" + key,function(data) {
post_amount = data.response.blog.posts
$.getJSON(api + "posts/text?&filter=text&limit=" + post_amount + "&" + key,function(data) {
$.each(data.response.posts, function(i, item) {
var content = item.body
$("#Posts ul").append('<li>' + content + '</li>')
});
})
})
}
这是一个用于测试的不错的Tumblr博客示例: http://only-text-posts.tumblr.com/