调用Facebook新闻Feed(me / home)直到参数,每次连续调用返回limit / 2 [英] Calling Facebook News feed (me/home) with until parameter, returns limit/2 each consecutive call
问题描述
这是我的代码的缩小版本(没有初始化调用)。一切都很完美,除了每个连续的电话我通过直到值为 FB.api ,返回我的limit / 2。我尝试使用不同的Facebook帐户等待长达1分钟的通话时间,但并不能帮助您。
Here is a slimmed down version of my code (without the initialization calls). Everything works perfectly, except that every consecutive call I make passing in an until value into FB.api, returns me limit/2. I have tried waiting as much as 1 minute in between the calls, using different Facebook accounts but it does not help the matter.
我查看了返回对象中的下一个参数,URL直接添加直到与我的 dataUltimoPost 相同的号码。当我打电话给URL时,它也返回一半的帖子。
I checked the next parameter in the returned object, and the URL simply adds the until parameter with the exact same number as my dataUltimoPost. When I call the URL, it too returns half the posts.
我发现其他帖子的回报不一致这里和这里,但是没有直接地寻址分页方面。巧合的是,我遇到了这篇文章,它使用与我的代码相同的逻辑页面发布。所以我认为我在正确的轨道上。
I found other posts with inconsistent returns here and here, but none address the paging aspect directly. Coincidentally, I came across this post which uses the same logic as my code to page posts. So I think I'm on the right track.
功能:
function getPost (success, append) {
var params = { limit: 25, date_format: 'U' };
if (append)
params.until = dataUltimoPost;
FB.api('/me/home', 'get', params, function (userData) {
if (userData.data.length > 0)
dataUltimoPost = userData.data[userData.data.length - 1].created_time - 1;
success.call(this, userData.data, append);
});
};
function fillPost(posts, append) {
var postsHTML = '';
append = append === true;
alert('posts.length: ' + posts.length + ' - append: ' + append);
}
调用函数:
getPost(fillPost); //returns 25
getPost(fillPost, true); //returns 12
getPost(fillPost, true); //returns 1 or 0
推荐答案
Facebook自己为什么你不要得到25结果,当要求25。
Here's a blog post from Facebook themselves for the reason why you don't get back 25 results when asking for 25.
http://developers.facebook.com/blog/post/478/
这里他们我们清楚地承认,在应用过滤之前,他们的FQL过滤机制预先限制了结果集。
Here they've clearly admitted that their FQL filtering mechanism pre-limits the result set BEFORE applying filtering. Here's a visual on what's happening.
这篇关于调用Facebook新闻Feed(me / home)直到参数,每次连续调用返回limit / 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!