简体   繁体   English

Facebook Graph API:按教育历史记录过滤Facebook朋友

[英]Facebook Graph API: Filter Facebook friends by education history

Is it possible to filter someone's facebook friends by education when you access them through the Graph API. 通过Graph API访问某人的Facebook朋友时,是否可以通过教育过滤他们。 I am trying to make it so a website displays only someone's friends who attended a certain school. 我正在尝试使网站仅显示某人上某所学校的朋友。 Right now, I can do it by making a call to get the user's friends, then iterating through each friend, making a subsequent call and checking if their education data matches, but this seems really inefficient and takes a long time to work. 现在,我可以通过打一个电话来吸引用户的朋友,然后遍历每个朋友,再打一个电话,并检查他们的教育数据是否匹配,来做到这一点,但这似乎效率很低,并且需要很长时间才能工作。 Ideas? 有想法吗? See my code below: 请参阅下面的代码:

def set_up_graph
  @access_token = @facebook_cookies["access_token"]
  @graph = Koala::Facebook::API.new(@access_token)
  @profile = @graph.get_object("me")
  @friends = @graph.get_connections("me","friends")
end

def find_network_friends
  @netfriends = Set.new
  @friends.each do |friend|
  id = friend["id"]
  tempf = @graph.get_object(id)
  education = tempf["education"]
  unless education == nil
    education.each do |ed|
      if ed["school"]["name"] == "Pomona College"
        @netfriends.add(id)
      end
    end
  end
end

end 结束

您是否研究过FQL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM