我正在使用JavaScript来检索朋友的信息,如下所示:
FB.api('/me/friends', {fields:'name,id,hometown,education'}, function(response){
var l=''
$.each(response.data,function(idx,val){
l=l+val.id+(idx<response.data.length-1?',':'')
});
FB.api("likes?ids="+l,function(res){
allLikes = res;
});
}
使用上面的代码,我已成功检索到所有用户朋友的所有喜欢。我想检查用户的哪些朋友喜欢某个特定页面。响应数据约为1.5MB。我必须逐个遍历所有朋友的个人喜欢来解决这个问题。如何仅检索已经喜欢特定页面的朋友的信息?
答案 0 :(得分:0)
您可以使用以下FQL查询获取喜欢特定<page_id>
的用户朋友的所有用户ID。
FB.api({
method: 'fql.query',
query: 'select uid from page_fan where page_id=<page_id>
and uid in (select uid2 from friend where uid1=me())'
},function(response){
//do what you want to do with user ids (uid) you got
});