Go Back   Android Forums > Android Discussion > Android Lounge
Android Lounge A place for general Android discussion and questions.
Gamers - Check out our new sister sites!
Nintendo Wii U!    |    OUYA - $99 Android System!

test: Reply
 
LinkBack Thread Tools
Old December 10th, 2011, 02:53 PM   #1 (permalink)
Member
Thread Author (OP)
 
Join Date: Nov 2011
Location: DC
Posts: 301
 
Device(s): Galaxy Nexus VZ
Carrier: Not Provided

Thanks: 88
Thanked 1,235 Times in 202 Posts
Default How to export your friends list from Facebook! (must be rooted)

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!

zedster is offline  
Reply With Quote
The Following User Says Thank You to zedster For This Useful Post:
argedion (May 28th, 2012)
Sponsors
Old May 28th, 2012, 11:54 AM   #2 (permalink)
New Member
 
Join Date: Jul 2010
Posts: 3
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

Great tip! I automated this a bit more for users with a linux system:

update.sh:
Code:
#! /bin/sh
adb root
adb pull /data/data/com.facebook.katana/databases/fb.db
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
perl friend_frob.pl friends.csv > friends.vcf
friend_frob.pl:
Code:
#!/bin/perl

use strict;
use warnings;
use Text::CSV;

my $csv = Text::CSV->new ({ binary => 1 });
my $file = $ARGV[0];
open(my $data, '<', $file) or die "Could not open '$file'\n";

$csv->column_names ($csv->getline ($data));
while (my $fields = $csv->getline_hr ($data)) {
    print "BEGIN:VCARD\n";
    print "VERSION:3.0\n";
    printf ("FN:%s\n", $fields->{display_name});
    printf ("N:%s;%s;;;\n", $fields->{last_name}, $fields->{first_name});
    if ($fields->{email} ne "") { printf ("EMAIL;TYPE=INTERNET:%s\n", $fields->{email}); }
    if ($fields->{cell} ne "") { printf ("TEL;TYPE=CELL:%s\n", $fields->{cell}); }
    if ($fields->{other} ne "") { printf ("TEL:%s\n", $fields->{other}); }
    if ($fields->{birthday_day} != -1) {
    if ($fields->{birthday_year} == -1) {
        printf ("BDAY:%s/%s\n", $fields->{birthday_month}, $fields->{birthday_day}); 
    } else {
        printf ("BDAY:%s-%s-%s\n", $fields->{birthday_year}, $fields->{birthday_month}, $fields->{birthday_day});
    }
    }
    printf ("PHOTO;VALUE=URL:%s\n", $fields->{user_image_url});
    print "END:VCARD\n";
}
Now all the data is in a standard vCard file.
jicama is offline  
Reply With Quote
The Following User Says Thank You to jicama For This Useful Post:
argedion (May 28th, 2012)
Reply


Go Back   Android Forums > Android Discussion > Android Lounge
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:39 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.