brad's life - AddressBooker & exporting my Facebook Phonebook [entries|archive|friends|userinfo]
Brad Fitzpatrick

[ website | bradfitz.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

AddressBooker & exporting my Facebook Phonebook [Nov. 30th, 2008|09:25 pm]
Previous Entry Share Next Entry
[Tags|, , , ]

This 4-day weekend was awesome for catching up on personal hacking projects. In addition to adding IPv6 support to Perlbal and hacking on my interactive shadow/art wall more, I also worked on a little address book management tool, AddressBooker [source here].

Basically AddressBooker takes a POST of contacts data in JSON form, and does stuff with it, where "stuff" is currently limited to merging it into your Google Contacts. (GMail, Android, etc) This was my experiment in learning GData, AuthSub, and App Engine a bit more.

Anyway, I then wanted to get my Facebook Phonebook exported to my Google Contacts, so it'd sync to my Android phone. I didn't see an export option in Facebook (maybe I missed it?), so I wrote a little GreaseMonkey script instead to automate the whole process:

http://bradfitz.com/greasemonkey/facebook_phonebook_export.user.js

If you have Firefox and GreaseMonkey, then click the above link and it'll ask if you want to install it. Install it, then go to your Facebook Phonebook (sorry, no permalink to it), then go into Tools > GreaseMonkey > User Script Commands... > and you'll see Export Facebook Phonebook. That'll then page through your phone book (you should probably start on page 1: it's kinda flaky) and extract the data, and then POST it to AddressBooker for you, which will then guide you through merging it into your Google Contacts.

Enjoy!

(And keep in mind I barely know browser stuff or Greasemonkey or Python or App Engine or GData, so patches welcome!... brad@danga.com, or Github)

Update 2009-05-09: Updated the JavaScript to work with Facebook's new layout.

Update 2010-06-06: Facebook's markup changed again, but I'm too lazy to go update the script. Patches welcome.
Link

Comments:
From: bewlay_brother
2008-12-13 07:53 pm (UTC)

ToS violation

(Link)

Having spent a lot of time in the FB world, this is probably against the Terms of Use. http://www.facebook.com/terms.php

Specifically, the following clauses:
"All content on the Site and available through the Service, including designs, text, graphics, pictures, video, information, applications, software, music, sound and other files, and their selection and arrangement (the "Site Content"), are the proprietary property of the Company, its users or its licensors with all rights reserved. No Site Content may be modified, copied, distributed, framed, reproduced, republished, downloaded, scraped, displayed, posted, transmitted, or sold in any form or by any means, in whole or in part, without the Company's prior written permission, except that the foregoing does not apply to your own User Content (as defined below) that you legally post on the Site."

And
"In addition, you agree not to use the Service or the Site to: ... use automated scripts to collect information from or otherwise interact with the Service or the Site"

On top of the legalese, the spirit of the Facebook Terms of Use is that people should have control over their privacy through FB, no matter where that information resides. Facebook would say, "What if someone changes their privacy preferences so that you're no longer allowed access to their phone number? Or what if they change numbers? Your data will at best be out of date and at worst violate their privacy."

Since Facebook offers no controlled mechanism for accessing phone numbers I think it's a safe bet that they don't want users exporting their friends phone numbers, no matter what.

YMMV, I guess, since Facebook is notoriously inconsistent in enforcing their terms of service.
(Replies frozen) (Thread)
[User Picture]From: brad
2008-12-13 07:56 pm (UTC)

Re: ToS violation

(Link)

Use at your own risk, then. However, the script does do 1 second pauses between flipping pages, and HTTP requests come from your own browser's user-agent and cookies, so it'd be a little hard to fingerprint.
(Replies frozen) (Parent) (Thread)