How to crawl Facebook based on friendship informat

2019-03-09 22:21发布

问题:

I'm a graduate student whose research is complex network. I am working on a project that involves analyzing connections between Facebook users. Is it possible to write a crawler for Facebook based on friendship information?

I looked around but couldn't find any things useful so far. It seems Facebook isn't fond of such activity. Can I rely on the Facebook API?

Update (Jan-08-2010): Thank you very much for the responses. I guess I probably need to contact Facebook directly then. Cheers

Update (Feb-16-2011): A new book, "Mining the social web", just came out. In it, there is a chapter devoted entirely for mining Facebook using Python. Cheers.

回答1:

You can't rely on the Facebook API unfortunately. To get friend information, you need to use something like friends.get(). However, any Facebook API method that returns user information like this requires that you have an active session key from that user, and generally the way you get an active session key is to have the user come to your Facebook application or page.

In summary, the information you are talking about is essentially private. You can't pick a person from Facebook, get their friends, and get those friend's friends, and so on. To me this is a good thing for privacy, but of course it prevents arbitrary analysis.

I'd throw out the idea of writing a quick and dirty application with some user appeal that you could use for research. If a group like S**t My Dad Says (funny, not really safe for work) can get 120,000 users in a couple of months, you could probably plead your case with a small research application and get a reasonable amount of users.



回答2:

The problem is that facebook friendship information is typically private and only accessible to friends. It should be a lot easier to build this network on Twitter, if this is an option for you.



回答3:

As others have stated, this is typically private information. If, however, Facebook per se isn't a requirement, you could use Google's Social API. A snippet from the Google Social Graph API page: "With the Social Graph API, developers can now utilize public connections their users have already created in other web services. It makes information about public connections between people easily available and useful."

Here's an article on using it in Ruby: http://articles.sitepoint.com/article/google-social-graph-api-ruby-rails#



回答4:

This lifecode post provide a basic python script to scrape your facebook friends contact info. The output of this script, is the profile ID, profile pame, profile URL, e-mail address and mobile/phone number (if provided by friend). WARNING: This is against Facebook TOS. Use at your own risk. Info provided for educational and research purposes http://ruel.me/blog/2010/11/26/scrape-your-facebook-friends-contact-info-with-python/



回答5:

You can use http://www.facebook.com/directory/ to get the public listed people.