Skip to content

Instantly share code, notes, and snippets.

@notruri
Last active October 21, 2025 13:30
Show Gist options
  • Select an option

  • Save notruri/5cd761e1d91ca8e1f1da2724a196763f to your computer and use it in GitHub Desktop.

Select an option

Save notruri/5cd761e1d91ca8e1f1da2724a196763f to your computer and use it in GitHub Desktop.

facebook friends exporter

usage

  1. open your browser and go to https://www.facebook.com/friends/list

  2. scroll down until the page finishes loading all of your friends. (Keep scrolling until you reach the bottom.)

  3. open the developer console

    • Chrome / Edge: Ctrl+Shift+J or F12 → Console tab
    • Firefox: Ctrl+Shift+K
    • Safari: Cmd+Option+C

Note

some browsers require you to allow pasting into the console first. if prompted, type allow pasting and press Enter.

  1. copy the JavaScript code below and paste it into the console, then press Enter:
expand code

triple click and CTRL + C to copy

this is minified so that it can be copied easily, use a beautifier if you're curious what it does.

!function(){let e=Array.from(document.querySelectorAll('[data-visualcompletion="ignore-dynamic"]')).reduce((e,t)=>{let a=t.querySelector('svg[data-visualcompletion="ignore-dynamic"]')?.getAttribute("aria-label"),o=t?.getElementsByTagName("a")[0]?.getAttribute("href");return a&&o&&e.push({name:a,url:o}),e},[]);if(!e)return console.error("No data found");let t=prompt("Choose an option:\n1 – Show data as table\n2 – Download JSON file\n3 – Do both");if(!t||isNaN(+t))return console.error("Invalid action");if("1"===t)console.table(e);else if("2"===t||"3"===t){"3"===t&&console.table(e);let a=JSON.stringify(e,null,2),o=new Blob([a],{type:"application/json"}),n=URL.createObjectURL(o),r=document.createElement("a");r.href=n,r.download="facebook_friends.json",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}}();

Authors

Licenses

  • MIT License

Credits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment