Export your facebook contacts with email addresses

facebook officesFirst of all a big apology because this method of exporting your Facebook contacts is very cumbersome and has several “odd” requirements.
Nonetheless it is presented here as one (desperate) option to export your Facebook contacts and their contact details such as email address and phone number.
This method can be improved upon and made more automatic but Facebook has a tendency to shut down any scripts and software that export contact details.
So instead I leave it as an exercise to the readers to automate this process and extend it with a possible vCard conversion or Outlook import.
You will need:
* Firefox browser
* The XHTML mobile profile add-on for Firefox
* Able to view option 4 (ie Contacts) when accessing Facebook mobile
* Be able to access the internet from your PC by using your mobile device (eg via Bluetooth or IR)
* A text formatting tool (eg. grep)
The option 4 (Contacts) is ideal for exporting your contact details as it lists email addresses and phone numbers as clear text.
On the web version of Facebook the email addresses are displayed as images and a optical character recognition (OCR) process has to be used to decode the email address.
This OCR process is never perfect and will sometimes result in incorrect contact details.
The idea presented here is that you connect your PC to the Internet via your mobile phone (bluetooth, serial, IR or whatever works for you).
You have installed the XHTML mobile profile in Firefox which will let you visit the mobile version of Facebook (m.facebook.com).
Because you are using your mobile operator, Facebook will assume you are on a mobile device and display the shy option 4, contacts.
Step through your contacts and save each page as a text file locally on your computer.
Last step is to combine the saved text files to a single file and use egrep secret sauce to create a neat comma separated (CSV) file with just names, email addresses and phone numbers.
One regular expression that may get you started would be:
/profile\.php([^>]*)>([^<]*)<\/a><br\/>(<small><a href=\"tel:)?([0-9\.]*)?(\">)?([0-9\.]*)?(<\/a><\/small><br\/>)?<small><a href=\"mailto:([^\"]*)/
The best way to automate the exporting of Facebook contacts would be to write a small application for a mobile device (eg in J2ME) that fetches the information and formats it for export.
Another option would be to use Cygwin tools such as curl and grep to automate the process on your PC.
The j2me application would be most fun to do and I may return to it one fine Sunday afternoon!
[Photo by pshab]

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.