How to liberate your phone book from facebook

This is a quickly written, hacky script for personal use. For the time being, this script will only work on 99 friends at a time (Amusingly, facebook thinks there are 100 on the first page, but you're welcome to count. There are 99. Buggy programming FTW!). I'm playing with a workaround, but don't hold your breath. In the meantime, you can do the following to take your friend's phone numbers back into your own care:

  1. Login to facebook.
  2. Go to http://www.facebook.com/friends/edit/?sk=phonebook&offset=0 (or, if you're looking to get contacts 100-199, etc, change the "offset=" term).
  3. Press ctrl+a, ctrl+c to grab your info.
  4. Open up your favorite text editor and paste (ctrl+v) into a blank file. Save this file as "raw_phones.txt".
  5. Download "fb_phone_to_csv.py"[Dropbox]. Save it into the same directory as "raw_phones.txt". Run it (you'll need python.).
  6. You ought to see a new file in the directory, "phone_numbers.csv". This contains your phone's information, formatted in a Google CSV.
This CSV can be directly uploaded to Gmail, and merged into any existing data you might have, as is described below.

  1. Login to Gmail.
  2. On the left, click Contacts.
  3. Click "More Actions">"Import"
  4. Select "phone_numbers.csv" (created above) and hit import!
  5. Once this is done, click "More Actions">"Find & merge duplicates". Check the duplicates it finds and accept what you want to.
  6. Done! Your facebook phone numbers are all integrated. You can go to "More Actions">"Export" to move your Gmail contacts elsewhere if you want to. 
It's a shame facebook doesn't hold itself to the same kind of integrity and responsibility when  it comes to user data that Google does. If they did, this tutorial would be a hell of a lot shorter.

Boring legal stuff, etc:
I'm releasing the .py file above under an MIT Software Licence. You are free to make derivative works, ports, or apps (and even sell them).  I do appreciate credit though, and I ask that you seriously consider releasing any derivatives for free.
If you have improvements you'd like me to incorporate, feel free to comment with a Dropbox link (or similar). I'll patch it if your code looks useful and give you credit.

    No comments:

    Post a Comment