javascript - Calling Facebook News feed (me/home) with until parameter, returns limit/2 each consecutive call -
here slimmed down version of code (without initialization calls). works perfectly, except every consecutive call make passing in until value fb.api, returns me limit/2. have tried waiting as 1 minute in between calls, using different facebook accounts not matter.
i checked next parameter in returned object, , url adds until parameter exact same number dataultimopost. when call url, returns half posts.
i found other posts inconsistent returns here , here, none address paging aspect directly. coincidentally, came across this post uses same logic code page posts. think i'm on right track.
functions:
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); } calling functions:
getpost(fillpost); //returns 25 getpost(fillpost, true); //returns 12 getpost(fillpost, true); //returns 1 or 0
here's blog post facebook reason why don't 25 results when asking 25.
http://developers.facebook.com/blog/post/478/
here they've admitted fql filtering mechanism pre-limits result set before applying filtering. here's visual on what's happening.

Comments
Post a Comment