Posted by theharmonyguy in Facebook | 17 comments
An Updated Guide to Backing Up or Exporting Your Facebook
Last update: April 27 at 6:30 p.m. EST
At the beginning of this year, I posted a series of FQL queries that would enable Facebook users to backup most of their account information. While a few services offering Facebook backups exist (see Part 6 below), I noted that none of them were anywhere near as comprehensive as using FQL when it came to messages and metadata. Over time, I added more queries and tricks to provide a more complete archive. Eventually, the only major block of information missing from the method was the e-mail addresses of friends.
I discovered that fellow blogger Tutkiun had found a way to exploit a Microsoft import tool to harvest friends’ addresses, but it was more obtrusive than I desired, since it required sending a Microsoft invitation message to all of those addresses during the import. At the time, though, the Tutkiun’s trick was the only legitimate way of exporting e-mail addresses.
In the last few weeks, though, Yahoo! has added an import tool to their e-mail product, and this now allows you to export your friends’ addresses quite easily and without sending any e-mails. Given this new feature and the slightly messy state of my last post, I decided to gather all of the current tricks for Facebook export and re-post them in this updated guide. Note that this guide can be rather technical, and most of the data provided will be in special formats that you likely won’t be able to browse and edit easily. If you’re looking for a simpler but less exhaustive approach, check out the services I discuss in Part 6 of this post.
I’ll note, though, that while this guide now gives you a very thorough export of their accounts, you may be disappointed to discover you have hardly anywhere to then import the information. Personally, I consider this method better suited for archiving your Facebook information than anything else. I think the best solution for “taking your social graph with you” will involve data portability which integrates with the Facebook API, but that will have to wait for another post.
I’ve divided my guide into seven parts. The first part can be accomplished using only the Facebook API Test Console. The second part involves a little trick for gathering phone numbers. The third section requires some technical know-how, as you need to administer a Facebook application. The fourth part describes using Yahoo! to get e-mail addresses. The fifth part provides option FQL queries for those wishing to archive even more of their information. The sixth section discusses solutions for backing up photos and videos, since the FQL queries only provide metadata and not the actual files. Finally, the seventh part adds some notes, tips, and limitations about the overall process. The second part yields data in JSON format, while the first, third, and fifth parts can either load JSON (my preference due to smaller file size) or XML. With the fourth section, Yahoo! can export to CSV format.
Update 1: Added optional queries 7-11, info on Fotobounce
Update 2: Last week, Facebook introduced new methods and APIs for application authentication and access. As part of the shift to these new offerings, the company has apparently taken down the API Test Console referenced in this post. All of the FQL queries listed here should still work for an authorized application, but unfortunately executing is no longer quite as simple if you’re not as familiar with application development.
Part 1: Standard FQL Queries
All of these queries can be executed using the Facebook API Test Console. Set the respone format to XML or JSON (I recommend JSON), select “fql.query” for the method, then fill in the query box. In each query, replace 00000000 with your Facebook ID number. (One way of finding this number is to visit your Facebook profile, right-click the link to “See All” of your friends, and copy the address. In the address, the number that follows “id=” is your Facebook ID.)
- Profile information of you and your friends: SELECT uid, first_name, last_name, name, pic_big, affiliations, religion, birthday, birthday_date, sex, hometown_location, political, current_location, activities, interests, music, tv, movies, books, quotes, about_me, hs_info, education_history, work_history, profile_url, profile_blurb, family, username, website FROM user WHERE uid = 00000000 OR uid IN (SELECT uid2 FROM friend WHERE uid1 = 00000000)
- Your friend lists: SELECT flid, name FROM friendlist WHERE owner = 00000000
- The members of your friend lists: SELECT flid, uid FROM friendlist WHERE flid IN (SELECT flid FROM friendlist WHERE owner = 00000000)
- Pages you’re a fan of: SELECT page_id, name, pic_big, website, type FROM page WHERE page_id IN (SELECT page_id FROM page_fan WHERE uid = 00000000)
- Links you have posted: SELECT link_id, owner_comment, created_time, title, summary, url, image_urls FROM link WHERE owner = 00000000
- Events you have attended: SELECT eid, name, tagline, pic_big, host, description, event_type, event_subtype, start_time, end_time, creator, location, venue FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid = 00000000 AND rsvp_status = “attending”)
- Your notes: SELECT note_id, title, created_time, content FROM note WHERE uid = 00000000
- Comments on your notes: SELECT object_id, post_id, fromid, time, text FROM comment WHERE object_id IN (SELECT note_id FROM note WHERE uid = 00000000)
- Your photo albums: SELECT aid, cover_pid, name, created, modified, description, location, size, link, visible, modified_major, type, object_id FROM album WHERE owner = 00000000
- Comments on your photo albums: SELECT object_id, post_id, fromid, time, text FROM comment WHERE object_id IN (SELECT object_id FROM album WHERE owner = 00000000)
- Your photos’ metadata: SELECT pid, aid, src_big, src_big_height, src_big_width, link, caption, created, modified, object_id FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner = 00000000)
- Comments on your photos: SELECT object_id, post_id, fromid, time, text FROM comment WHERE object_id IN (SELECT object_id FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner = 00000000))
- People tagged in your photos: SELECT pid, subject, text, xcoord, ycoord, created FROM photo_tag WHERE pid IN (SELECT pid FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner = 00000000))
- Your videos’ metadata: SELECT vid, title, description, thumbnail_link, embed_html, updated_time, created_time FROM video WHERE owner = 00000000
- Comments on your videos: SELECT object_id, post_id, fromid, time, text FROM comment WHERE object_id IN (SELECT vid FROM video WHERE owner = 00000000)
- People tagged in your videos: SELECT vid, subject FROM video_tag WHERE vid IN (SELECT vid FROM video WHERE owner = 00000000)
- Groups you’re a member of: SELECT gid, name, nid, pic_big, description, group_type, group_subtype, recent_news, creator, update_time, office, website, venue, privacy FROM group WHERE gid IN (SELECT gid FROM group_member WHERE uid = 00000000)
Part 2: Phone Numbers
Visit this URI: http://www.facebook.com/friends/ajax/superfriends_phonebook.php?__a=1 The “payload” parameter lists any phone numbers of Facebook friends you can access, sorted by the Facebook ID number of each friend.
Part 3: Extended FQL Queries
These queries can only be executed by an application with certain extended permissions, and the Test Console does not have any. To perform these queries on your own, you need to have a Facebook application you administer. You can then enable the needed permissions using the following two URIs, replacing “ffffffffffffffffffffffffffffffff” with the application’s API key:
- http://www.facebook.com/authorize.php?api_key=ffffffffffffffffffffffffffffffff&v=1.0&ext_perm=read_mailbox
- http://www.facebook.com/authorize.php?api_key=ffffffffffffffffffffffffffffffff&v=1.0&ext_perm=read_stream
Once these permissions are enabled, you can again use the API Test Console by setting the application field accordingly.
- Threads in your inbox (requires “read_mailbox” permissions): SELECT thread_id, folder_id, subject, recipients, updated_time, parent_message_id, parent_thread_id, message_count, snippet, snippet_author, object_id FROM thread WHERE folder_id = 0
- Threads in your outbox (requires “read_mailbox” permissions): SELECT thread_id, folder_id, subject, recipients, updated_time, parent_message_id, parent_thread_id, message_count, snippet, snippet_author, object_id FROM thread WHERE folder_id = 1
- Messages in your inbox (requires “read_mailbox” permissions): SELECT message_id, thread_id, author_id, body, created_time, attachment FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0)
- Messages in your outbox (requires “read_mailbox” permissions): SELECT message_id, thread_id, author_id, body, created_time, attachment FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0)
- Your wall posts (requires “read_stream” permissions): SELECT post_id, app_id, source_id, updated_time, created_time, attribution, actor_id, target_id, message, app_data, action_links, attachment, comments, likes, privacy, permalink, tagged_ids, is_hidden FROM stream WHERE source_id = 00000000
- Comments on your wall posts (requires “read_stream” permissions): SELECT post_id, fromid, time, text FROM comment WHERE post_id IN (SELECT post_id FROM stream WHERE source_id = 00000000)
Part 4: E-mail Addresses
This part requires you to have a Yahoo! Mail account. If you don’t already have one, you can create one for free. In fact, I’d advise creating a new account to avoid your Facebook friends’ e-mail addresses getting mixed up with any others already in your address book.
- To add your friends’ e-mail addresses to your Yahoo! Address Book, follow the steps given on this page at the Yahoo! Mail blog. Essentially, you simply click “Import Contacts,” choose “Facebook,” and follow the steps. You will have to authorize a Facebook application built by Yahoo! for this purpose.
- To save a local copy of these addresses, you can use the export tools in Yahoo! Address Book. This help page from Yahoo! provides information on ways to transfer contacts from Yahoo! to various other programs. These specific steps are given for saving your entire address book as a CSV file:
- Open your Yahoo! Address Book and click “Import/Export” in the upper-right corner.
- In the Export section, click “Export Now” next to the phrase “Microsoft Outlook.”
- A dialog window opens and gives you the option to save your Yahoo! Address Book to disk as a .csv file. Click “Save to Disk”.
- Click “OK”.
Part 5: Optional FQL Queries
These FQL queries can be in the same way as those from Part 1, since they do not require any extended permissions. Personally, I think they go somewhat beyond the scope of what I’d consider an account backup, but people have shown an interest in exporting more information and none of these queries provide content not already accessible to you via the Facebook site. By the way, I’m not aware of a way to access who was tagged in notes and thus save the notes you’re tagged in.
- Photos you’re tagged in: SELECT pid, aid, src_big, src_big_height, src_big_width, link, caption, created, modified, object_id FROM photo WHERE pid IN (SELECT pid FROM photo_tag WHERE subject = 00000000)
- Comments on photos you’re tagged in: SELECT object_id, post_id, fromid, time, text FROM comment WHERE object_id IN (SELECT object_id FROM photo WHERE pid IN (SELECT pid FROM photo_tag WHERE subject = 00000000))
- People tagged in photos you’re tagged in: SELECT pid, subject, text, xcoord, ycoord, created FROM photo_tag WHERE pid IN (SELECT pid FROM photo WHERE pid IN (SELECT pid FROM photo_tag WHERE subject = 00000000))
- Videos you’re tagged in: SELECT vid, title, description, thumbnail_link, embed_html, updated_time, created_time FROM video WHERE vid IN (SELECT vid FROM video_tag WHERE subject = 00000000)
- Comments on videos you’re tagged in: SELECT object_id, post_id, fromid, time, text FROM comment WHERE object_id IN (SELECT vid FROM video WHERE vid IN (SELECT vid FROM video_tag WHERE subject = 00000000))
- People tagged in your videos you’re tagged in: SELECT vid, subject FROM video_tag WHERE vid IN (SELECT vid FROM video_tag WHERE subject = 00000000)
- People who liked your notes: SELECT object_id, user_id FROM like WHERE object_id IN (SELECT note_id FROM note WHERE uid = 00000000)
- People who liked your photos: SELECT object_id, user_id FROM like WHERE object_id IN (SELECT object_id FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner = 00000000))
- People who liked your videos: SELECT object_id, user_id FROM like WHERE object_id IN(SELECT vid FROM video WHERE owner = 00000000)
- People who liked photos you’re tagged in: SELECT object_id, user_id FROM like WHERE object_id IN (SELECT object_id FROM photo WHERE pid IN (SELECT pid FROM photo_tag WHERE subject = 00000000))
- People who liked videos you’re tagged in: SELECT object_id, user_id FROM like WHERE object_id IN (SELECT vid FROM video WHERE vid IN (SELECT vid FROM video_tag WHERE subject = 00000000))
Part 6: Photos and Videos
The FQL queries in previous sections relating to photos and videos save metadata (e.g. caption, size, date uploaded, etc.) but not the actual files themselves. For photos, one field (src_big) provides a direct URI for downloading the file, and programmers so inclined could build scripts that process the JSON data and download all of the referenced files.
Several other options already exist, though, for downloading photos. Currently I know of these:
- Backupify. This service provides online backups of many online sites besides just Facebook. Their basic plan is free and provides backups for one account per site (e.g. one Facebook account, one Twitter account, etc.). If you find my backup method too technical, Backupify’s Facebook archives include an XML file that contains a list of your friends (with birthdays and locations), your notes, your status updates, your links, and events you’ve attended. Backupify also saves a copy of all your photos and all photos you’re tagged in. With the free plan, your photos are stored online and you can download them individually, but you have to pay for a plan that offers ZIP archives for downloading multiple files at once (currently $39.95/year, though free on sale through March 21).
- SocialSafe. This is an application you install on your computer which uses the Facebook API to create local backups. If you find my backup method too technical, SocialSafe offers the advantage of an interface for easily browsing your backups and maintaining different versions over time, though at a small fee ($2.99 at time of publication). Currently, SocialSafe only backs up your profile information, a list of your friends, your wall posts, and your photos, but the developers have stated they plan on adding more data, and upgrades are free after your purchase. Note that SocialSafe only saves photos you have uploaded; their site says they removed the ability to download tagged photos for legal reasons. I don’t know the details of the situation, but it seems they wanted to avoid liability in case you are tagged in copyrighted photos.
- FaceDown. This is a free program you can download which mimics a web browser logging into Facebook and lets you save all of the photos linked from a given Facebook page. I’ll quickly add that this program violates a fundamental security practice in that it asks for your Facebook username and password directly. Normally I would say you should never provide such credentials to a non-Facebook service or program, but in this particular case, your options are somewhat limited and the program functions as a web browser (i.e. it does not store your credentials or forward them to a third party). Also, I’m not entirely sure if this program remains consistent with the Facebook terms of service, which forbids “automated means” of collecting information from other users. I know Facebook monitors such activity, so while it’s unlikely if you’re careful, using this program could risk your account being disabled by Facebook.
- ArchiveFacebook. This is a Firefox add-on (it requires the Mozilla Firefox web browser) which seeks to archive a variety of information from your Facebook account, including photos. However, I’m quite certain this add-on violates the Facebook terms of service, which forbids “automated means” of collecting information from users, and thus I cannot recommend it. Using this add-on will risk your account being disabled.
- Fotobounce. This is an application you install on your computer (Mac or Windows) that syncs local photo albums with those on Facebook, and even maintains tags in photos. It appears that if your Facebook were somehow deleted, this program would be the easiest for restoring photo albums. From what I understand, Fotobounce also offers export capabilities similar to other programs listed above.
Obviously, no option is perfect, but of the four, I would personally say that Backupify is the one I find most appealing – except that I’m intrigued by Fotobounce, which I only recently discovered. I should note that I have personally used only Backupify and SocialSafe.
For videos, I know of no simple way to download multiple files. However, I have created a JavaScript bookmarklet which loads the source MP4 file of a given Facebook video. To use it, bookmark this link in your web browser and load the bookmark when viewing a page for a Facebook video. The bookmarklet automatically loads a high quality version if it’s available. The source code for the bookmarklet is as follows:
javascript:(function(){x=document.getElementsByTagName(‘div’);for(y=0;y<x.length;y++){if(x[y].className.indexOf(‘mvp_player’)==0){z=’swf_’+x[y].id;}}eval(‘x=’+z+’.getVariable(“highqual_src”);’);if(!x){eval(‘x=’+z+’.getVariable(“video_src”);’);}x=x.replace(/[%]3A/,’:');x=x.replace(/[%]2F/g,’/');location=x;})()
Alternatively, I discovered that others have built a Firefox add-on (requires the Mozilla Firefox web browser) called Facebook Video which lets you download Facebook videos. I have not tested this add-on or investigated it much, but it certainly appears to be legitimate.
Part 7: Additional Notes
- With each FQL query, I have selected what I thought would be the most useful fields and what would yield reasonable response sizes. While I tried to make each request complete enough to represent a backup of the relevant information, you may disagree with my choices.
- Some of the FQL queries may generate very large responses, so wait a few minutes if the results do not appear right away. In some cases, you may need to limit requests (i.e. adding “LIMIT 1,500″ for the first 500 results, “LIMIT 501,1000″ for the second 500, etc.). I tested the first query in Part 1 against an account with about 700 friends and did eventually receive a response using the Test Console, but it was about 1.2MB of data.
- In my testing, the responses to these queries were complete, with one apparent exception. The query for comments on wall posts seemed to include only recent comments. I haven’t investigated the issue much yet but will post any updates if I find more information on the issue.
- Note that the optional queries in Part 5 will generate data that overlaps significantly with information from Part 1. For example, any photo that you are tagged in which you also uploaded will appear in queries from both sections.
- I have tested all of these techniques and they worked for me as described, but I can make no guarantee that they will work for you or continue to work in the future. I cannot guarantee your use of these methods will not result in any loss of information or exposure of personal information. Also, while I believe all of these methods follow any applicable terms of service at the time of publication (unless otherwise noted), I cannot guarantee that they do nor that they will be permitted in the future. You should not use these methods to download any content that you are not licensed to download. All of these instructions are provided simply as a convenience, and you follow them at your own risk.
- Please feel free to send questions or feedback to me (my e-mail is theharmonyguy@gmail.com), but realize I may not be able to provide technical support if you’ve never used FQL or worked with JSON data. This is not a general solution for non-technical users by any stretch, but it at least provides an option for backing up Facebook information that’s more complete than methods I’ve seen elsewhere.
Trackbacks/Pingbacks
- uberVU - social comments - Social comments and analytics for this post... This post was mentioned on Twitter by theharmonyguy: New Post: An Updated Guide to ...
- An Updated Guide to Backing Up or Exporting Your Facebook | Social … | Download Free Software Now! - [...] reading here: An Updated Guide to Backing Up or Exporting Your Facebook | Social … ...
- Backup or Export Your Facebook Account | Social Hacking - [...] post has been superseded by “An Updated Guide to Backing up or Exporting Your Facebook.” Please refer to the ...
- An Updated Guide to Backing Up or Exporting Your Facebook | Social … · Facebook Tips & Tricks - [...] the full article An Updated Guide to Backing Up or Exporting Your Facebook | Social … on the author’s ...
- Migrating from Facebook Page to Wordpress. | zaid:/dev/random - [...] I found a post that shows how to use the API test tool to query the FB database, the ...
- Weekly links (weekly) | Frontiering Talk - [...] An Updated Guide to Backing Up or Exporting Your Facebook | Social Hacking [...]
- Technophile Monkey » Blog Archive » Farewell, Facebook! - [...] alternative could be to register as Facebook developer and write your own application against the Facebook API to retrieve ...
- Cartoon: So Sue Me | AboutGadgets.info - [...] An Updated Guide to Backing Up or Exporting Your Facebook [...]
- "Google Me" Is Google’s Facebook Competitor | ConcerningFacebook.info - [...] An Updated Guide to Backing Up or Exporting Your Facebook [...]
- How to Export Your Facebook Friends’ E-mail Addresses | Social Hacking - [...] that’s not quite the case. Back in March, I published a guide to exporting data from Facebook using various ...
- Quotes aboutgadgets | Hi Tech Stuff Reviews & Updates - [...] An Updated Guide to Backing Up or Exporting Your Facebook … [...]
Thanks for this :) I lost my first fb account when fb thought I was a spam bot (I now don’t put http:// in front of links I share via fb chat because of that) – would have been nice to have known your tips before … :)
Thanks man, very useful info here.
Nice tips there but I have a question, API does not provide the ability to export the email field of a friend by using FQL or get_***.
How does Yahoo do it. Is the whole email thing related to Facebook Connect? Also with a quick google search one can see that it is not only Yahoo that offers this service
@stonerhash: I honestly don’t know how Yahoo does it. They seem to authenticate as any other application, but I’m guessing they use a private API call. Even if I knew what the request was, I doubt it would work on other applications.
I’m not sure what other services you’re referring to… the only approved methods I know of are Yahoo’s importer and Microsoft’s, but the latter requires you send a message to all the contacts during the import. Certain mobile devices can sync with Facebook, but that’s not very helpful if you don’t own such a device.
Thanks for the guide. I used Disco Explorer to back up my Wall, Links, and Notes, FacePad Firefox plugin to back up my photo albums (photos for the most part that I already have on my hard drive), and your Yahoo tips for emails — I’d like to try some of your other FQL tips, but I couldn’t find the Facebook API test console (your link is broken, couldn’t find another one quickly through google). I am not really a techie – I have a basic understanding of SQL (so those queries make some sense to me), and if I ever need the resulting JSON files, I’ll guess I’ll learn about it then . . .
Photo you are tagged in!! I am investigate this with my application but apparently if the photo you are tagged in does not owned by your friend but owned by your friend’s friend. I cannot able to recognize that tag from the application
Hi,
I like your guide very much. It’s far more complete than Socialsafe, Backupify, or ArchiveFb. However, I have a few questions.
1. Your link to API test console seems to be broken. Where do I enter my queries?
2. What will the backup copy look like? I’m sure it won’t have all the interface and such.
3. Is there a way to also download all the comments I’ve posted on other people’s walls/photos/status?
Thank you very much!
You can execute the commands in the query section of developers.facebook.
However, I can only execute point 1 of Part 1. For the rest of the commands, FB gives the following: “error_code”: 104,
“error_msg”: “Requires valid signature”,
Is there a way to circumvent this?
Thanks!
I’ve never used FQL Queries before and I can’t seem to make it work.. I’m trying to find a way that I can download/save all of my wall posts. Does anyone know an easy way of doing this short of copying and pasting the lot? :P Or perhaps someone can give me a bit more instruction on how to use the FQL thing :D. Thanks!
Is there a way to export a friend’s wall or archive their wall? There has to be a faster way to view “older posts” without having to click older posts over and over.
Nice post, those tips were really helpful. There are a lot of things to do on Facebook other than adding friends and joining groups.
@dclaar: Thanks for the tip! Sorry your comment didn’t show up at first – I think all the links made my spam filter flag it.
I’ve also noticed that some of the new developer pages have been updated with test consoles, so those might help as well. But if I get around to updating this guide, I’ll definitely check out the links you posted.
I was thinking of doing it myself, but at $2.99 for SocialSafe, it seems like I could spend my time doing something else. But my concern is security. As near as I can tell, there’s no way to verify that any of these (not just SocialSafe) aren’t copying your data anywhere and everywhere. Hmm, what price peace of mind?
Disco Explorer is gone – belonged to Angstro, bought by Google in August.
Tried the link below (of course with my id), where the query is provided in the url. I end up with an XML output that reports: error 104, Requires valid signature :-(
https://api.facebook.com/method/fql.query?query=SELECT%20uid%2Cfirst_name%2Clast_name%2Cname%2Cpic_big%2Caffiliations%2Creligion%2Cbirthday%2Cbirthday_date%2Csex%2Chometown_location%2Cpolitical%2Ccurrent_location%2Cactivities%2Cinterests%2Cmusic%2Ctv%2Cmovies%2Cbooks%2Cquotes%2Cabout_me%2Chs_info%2Ceducation_history%2Cwork_history%2Cprofile_url%2Cprofile_blurb%2Cfamily%2Cusername%2Cwebsite%20FROM%20user%20WHERE%20uid%3D00000000%20OR%20uid%20IN%20%28SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%3D00000000%29
Facebook now has a download option with some of this information:
http://www.askdavetaylor.com/how_to_download_personal_information_facebook.html
But I still don’t see a way to get comments I’ve left on the other people’s walls.
could this be used to search for friend BBM pin’s that they often have written on their profile?