Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
grab facebook friend URLs
var friends = document.querySelectorAll('._698 > div > a');
urls = [];
for (var i = 0, len = friends.length; i < len; i++) {
urls.push(friends[i].href);
}
JSON.stringify(urls);
@ummjackson

This comment has been minimized.

Copy link
Owner Author

commented Jun 11, 2018

  1. Go to your the "Friends" tab of your profile, keep scrolling until it's fully loaded.
  2. Copy/paste this into the developer tools console, hit enter.
  3. Grab the JSON and do what you want with it.
@jamshid

This comment has been minimized.

Copy link

commented Mar 7, 2019

Thanks! Here's a minor change to get your pending friend requests. I guess we'd have to use the facebook api to get the user ids / urls programmatically, without using the browser?

# Go to https://www.facebook.com/friends/requests/ then run this in the browser console to export friend requests:
var friends = document.querySelectorAll('.friendRequestItem > a');
urls = [];
for (var i = 0, len = friends.length; i < len; i++) {
urls.push(friends[i].href);
}
JSON.stringify(urls);

I am shocked Facebook only exports friends' names. Cambridge Analytica gets usable id's but not users?! ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.