09 Jul 2010, 07:13
Generic-user-small

Jed S (16 posts)

Hi All,

Quick question. How can I get the Facebook ids of the current logged in user’s second degree friends or friends-of-friends?

09 Jul 2010, 07:30
Generic-user-small

Jed S (16 posts)

Here are the references of what I want to do with my app:
- vark.com
- thread.com

09 Jul 2010, 12:51
Head_pragsmall

Mike Mangino (543 posts)

I would imagine that you could use FQL to do that. Use a subquery when querying the friends table.

Mike

09 Jul 2010, 15:05
Generic-user-small

Jed S (16 posts)

I tried that one too. Here’s the output:

current_user.facebook_session.fql_query(“select uid2 from friend where uid1 = xxxx”)
facebook.fql.query (1.81701397895813) format = XML, query = select uid2 from friend where uid1 = xxxx
=> [{“uid2”=>”yyyy”}, {“uid2”=>”yyyy”}, {“uid2”=>”yyyy”}, {“uid2”=>”yyyy”}]

current_user.facebook_session.fql_query(“select uid2 from friend where uid1 in (select uid2 from friend where uid1 = xxxx)”)
facebook.fql.query (0) Facebooker::Session::FQLStatementNotIndexable: Can’t lookup all friends of yyyy; can only lookup for the logged in user (xxxx) or for pairs of users: format = XML, query = select uid2 from friend where uid1 in (select uid2 from friend where uid1 = xxxx)
=> Facebooker::Session::FQLStatementNotIndexable Exception: Can’t lookup all friends of yyyy; can only lookup for the logged in user (xxxx) or for pairs of users

Where xxxx is the facebook id of the logged in user and yyyy is the facebook id of his friends.

09 Jul 2010, 15:32
Generic-user-small

Jed S (16 posts)

I tried this code too.

Facebooker::User.new(xxxx, Facebooker::Session.create).friends_with_this_app
facebook.friends.getAppUsers (1.01840281486511)
=> [yyyy, yyyy, yyyy, yyyy]

Facebooker::User.new(yyyy, Facebooker::Session.create).friends_with_this_app
facebook.friends.getAppUsers (0) Facebooker::Session::SessionExpired: Session key invalid or no longer valid:

09 Jul 2010, 17:01
Head_pragsmall

Mike Mangino (543 posts)

You may be able to do that using the new graph API. It seems to be more public. I’ve never tried to do this, so I don’t know for sure though.

Mike

  You must be logged in to comment