Is it possible to filter someone's facebook friends by education when you access them through the Graph API. 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 ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.