1. Download our Official Android App: Forums for Android!

How to export your friends list from Facebook! (must be rooted)

Discussion in 'Android Lounge' started by zedster, Dec 10, 2011.

  1. zedster

    zedster Android Enthusiast
    Thread Starter
    Rank:
    None
    Points:
    238
    Posts:
    314
    Joined:
    Nov 21, 2011

    Nov 21, 2011
    314
    1,225
    238
    Nick Burns
    DC
    I am writing a how-to guide for exporting your Facebook Friends list from any rooted android device.

    As of right now the following is the only way I've seen to export your friends list from facebook to a CSV that you can upload into any e-mail client, google + or just to have outside of Facebook

    What is needed:
    A rooted android device
    The facebook app installed
    A root file manager
    SQlite viewer for your Computer, I suggest the following SQLite Database Browser | Free Development software downloads at SourceForge.net
    10-15 minutes


    Step 1: Make sure you have the facebook app installed on your phone as well as a root file manager such as "Root Explorer"

    Step 2: Open your root explorer app and navigate to /data/data/com.facebook.com/katana/databases

    Step 3:Copy the facebook.db file to your sd card, this step will be different depending on what root file manager you used.
    If you are using Root Explorer here are the steps:
    1. long press on facebook.db until the options menus
    2. select copy, the paste and cancel buttons should now appear at the bottom of the screen
    3. press the parent folder button at the top of the windows until you are back in the root folder, it should now say mounted as r/o with a button to mount r/w at the top of the window
    4. Scroll down to "sdcard" and click on it
    5. Hit the paste button at the bottom of the screen, the file should now be on your SD Card​
    Step 4: Copy the file from your SD Card to your computer

    Step 5: Using the SQlite viewer open the facebook.db file

    Step 6: From the file menu select export->export table as csv

    Step 7: Select friend_data from the drop down menu and click export, save it where you like

    Step 8: You now have a CSV file with a list of all your friends, their e-mail and birthdays from Facebook that you may do with as you please!
     

    Advertisement

    argedion likes this.
  2. jicama

    jicama Lurker
    Rank:
    None
    Points:
    6
    Posts:
    3
    Joined:
    Jul 1, 2010

    Jul 1, 2010
    3
    1
    6
    Great tip! I automated this a bit more for users with a linux system:

    update.sh:
    Code (Text):
    1. #! /bin/sh
    2. adb root
    3. adb pull /data/data/com.facebook.katana/databases/fb.db
    4. sqlite3 -csv -header fb.db "select display_name,last_name,first_name,email,cell,other,birthday_year,birthday_month,birthday_day,user_image_url from friends;" > friends.csv
    5. perl friend_frob.pl friends.csv > friends.vcf
    friend_frob.pl:
    Code (Text):
    1.  
    2. #!/bin/perl
    3.  
    4. use strict;
    5. use warnings;
    6. use Text::CSV;
    7.  
    8. my $csv = Text::CSV->new ({ binary => 1 });
    9. my $file = $ARGV[0];
    10. open(my $data, '<', $file) or die "Could not open '$file'\n";
    11.  
    12. $csv->column_names ($csv->getline ($data));
    13. while (my $fields = $csv->getline_hr ($data)) {
    14.     print "BEGIN:VCARD\n";
    15.     print "VERSION:3.0\n";
    16.     printf ("FN:%s\n", $fields->{display_name});
    17.     printf ("N:%s;%s;;;\n", $fields->{last_name}, $fields->{first_name});
    18.     if ($fields->{email} ne "") { printf ("EMAIL;TYPE=INTERNET:%s\n", $fields->{email}); }
    19.     if ($fields->{cell} ne "") { printf ("TEL;TYPE=CELL:%s\n", $fields->{cell}); }
    20.     if ($fields->{other} ne "") { printf ("TEL:%s\n", $fields->{other}); }
    21.     if ($fields->{birthday_day} != -1) {
    22.     if ($fields->{birthday_year} == -1) {
    23.         printf ("BDAY:%s/%s\n", $fields->{birthday_month}, $fields->{birthday_day});
    24.     } else {
    25.         printf ("BDAY:%s-%s-%s\n", $fields->{birthday_year}, $fields->{birthday_month}, $fields->{birthday_day});
    26.     }
    27.     }
    28.     printf ("PHOTO;VALUE=URL:%s\n", $fields->{user_image_url});
    29.     print "END:VCARD\n";
    30. }
    31.  
    Now all the data is in a standard vCard file.
     
    argedion likes this.

Share This Page

Loading...