SHARE
TWEET

facebook_friends_backup

baptx Feb 4th, 2020 (edited) 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Facebook friends backup in web browser
  2.  * Scroll down to your friends page to load all profiles
  3.  * Copy-paste the script below in a web browser console (F12 key or Ctrl+Shift+K shortcut in a browser like Firefox) and press enter
  4.  * A textarea will appear at the end of the page so you can copy your friends list and paste it in a text file before saving it as a CSV file
  5.  * You can then view your backup in a spreadsheet editor like LibreOffice Calc
  6.  * You can also compare the backup with another one to see who removed you from their friends list (e.g. with the Linux diff command)
  7.  * If the friend changed their name or profile URL, you can still find them with their profile ID which is backed up in the last column (open facebook.com/PROFILE_ID in a web browser)
  8.  * The Facebook Graph API was not used because they are locking or deprecating most of their endpoints (e.g. https://developers.facebook.com/docs/graph-api/changelog/breaking-changes/#taggable-friends-4-4)
  9.  */
  10.  
  11. var list = document.getElementsByClassName("uiProfileBlockContent");
  12. var length = list.length;
  13. var data = [];
  14.  
  15. for (var i = 0; i < length; ++i) {
  16.     data[i] = list[i].firstElementChild.children[1].firstElementChild.firstElementChild.firstChild.nodeValue;
  17.     data[i] += "\t" + list[i].firstElementChild.children[1].firstElementChild.firstElementChild.href;
  18.     var json = JSON.parse(list[i].firstElementChild.children[1].firstElementChild.firstElementChild.getAttribute("data-gt"));
  19.     if (json) { // JSON data is null when the Facebook profile is deactivated
  20.         data[i] += "\t" + json.engagement.eng_tid; // get profile ID in case the Facebook user changes their profile URL
  21.     }
  22. }
  23.  
  24. var box = document.createElement("textarea");
  25. box.value = data.join("\n");
  26. document.body.appendChild(box);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top