Rails, Facebook API, Koala gem - get all user profiles that "love" the page

Using Rails3 and koala gem, how to get all user profiles that “love” the FB page (for example, http://facebook.com/DAKINE). Is it even possible? As a final result, I need to get a bunch of user profiles stored in db.

Thank!

+3
source share
1 answer

It's pretty easy to get any page you like on facebook, especially with the Koala gem. Since facebook is suitable for this page, publicly available ( see here ), you can access them without using the API key.

, : facebook.com/foofighters, :

graph = Koala::Facebook::GraphAPI.new
likes = graph.get_object("foofighters")["likes"]

, , , ( ) facebook? "" , - :

graph = Koala::Facebook::GraphAPI.new
@users.each do |user|
  user.likes = graph.get_object(user.facebook_id)["likes"]
  user.save
end
+5

All Articles