2

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

Sample sites that do the same behaviour are the following:

  • vark.com
  • thread.com
Bart
  • 19,692
  • 7
  • 68
  • 77

3 Answers3

3

Store the friends in an array then do the intersect yourself.

2

Following daaku's answer, it's technically not possible to get the friends of every friend. It is a limitation in the API. (Probably to block abusers from sending much spam etc.)

However, I checked out thread.com and it seems that on this particular website you have to log in with your facebook account (username + password).

As you probably know, you can actually see all the friends of a friend in the facebook web interface (when you're viewing their profile in a browser)

Knowing that, this is how I think they do it:

  • With an embedded browser in a background-application on their server, they log on to your facebook.
  • they navigate through the friends of every friend
  • they extract the necessary information (probably at least the username and id from this page)
  • voila.

However, I think this violates the facebook TOS, and it's also not ethical: at no time should you ask a user for their facebook password.

Pepijn Olivier
  • 927
  • 1
  • 18
  • 32
1

It is not possible to get a listing of friends of friends. Although, given two Facebook user ids you can check if they are friends using: http://developers.facebook.com/docs/reference/fql/friend

daaku
  • 2,797
  • 20
  • 20
  • Yeah. Its seems impossible to get friends-of-friends listing. I also tried to use the new graph API of Facebook but still no luck. Also, search using the friend FQL table requires the uid1 must be a logged in or else it will not give you an output. But... How did vark.com and thread.com did their friends-of-friends listing? If they can do it, then its possible to have the friends-of-friends listing right? Any idea on how they did it? – Riskbreaker Jul 11 '10 at 01:16