我需要以某种方式获取使用相同应用的朋友之间的共享喜欢,有些FQL最终会返回给我一个最常见的喜欢的列表,是否可能?
感谢。
答案 0 :(得分:0)
我已经看过这个了,为了根据可索引的user_id字段获取当前用户的喜欢,您需要为当前用户提供user_access令牌。
https://developers.facebook.com/docs/reference/fql/like/
这基本上意味着,只有特定时间的应用当前用户才能根据自己的喜好查询信息。类似以下查询的内容可能适合您。请注意,您需要read_stream权限
select object_id, user_id,object_type FROM like WHERE object_id in(SELECT object_id FROM like WHERE user_id =me()) and user_id in(select uid FROM user WHERE uid in(SELECT uid2 FROM friend where uid1 = me()) and is_app_user='true')
你可以试试
https://developers.facebook.com/tools/explorer/433871385166/?fql=select%20object_id%2C%20user_id%2Cobject_type%20FROM%20like%20WHERE%20object_id%20in(SELECT%20object_id%20FROM%20like%20WHERE%20user_id%20%3Dme())%20and%20user_id%20in(select%20uid%20FROM%20user%20WHERE%20uid%20in(SELECT%20uid2%20FROM%20friend%20where%20uid1%20%3D%20me())%20and%20is_app_user%3D'true')
然后,您很可能需要使用一些服务器端代码来分析返回的数据,以计算最受欢迎的数据。可能通过创建一个数组,循环遍历数据,检查数组中是否存在基于object_id的键,如果没有将该键添加到数组中,值为1(其中1是计数)否则将值增加1。
伪代码示例
$data; // This would be what was returned from your FQL query
$compare = array();
foreach($data as $value){
if(array_key_exists($value['object_id'],$compare)){
$compare['object_id'] = $value['object_id'] + 1;
}else{
$compare['object_id'] = 1;
}
}
// Do some sorting function to compare the counts.
//you would then probably need to batch queries to get the name/title of the object that the user has liked
我希望这能给你一个很好的起点