skip to Main Content

Is there a way to get the whole Facebook friends list using an api!

I’ve tried a lot of thing and here’s my shot:

FacebookClient f = new FacebookClient(access_token);
f.IsSecureConnection = true;
dynamic friendlist = await f.GetTaskAsync(@"https://graph.facebook.com/me/friendlists?access_token="+access_token);
t.Text = JsonConvert.SerializeObject(friendlist);

But all I got is an empty data!
Can anyone help me?

3

Answers


  1. The friendlists endpoint is deprecated, as you can see in the breaking changes log: https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#tagged-users-4-4

    It would not have been what you expected anyway, it was only for lists, not friends directly. Access to all friends is not possible since a very long time. You can only get data of users/friends who authorized your App. You can use the /me/friends endpoint for that.

    Another thread about getting all friends: Facebook Graph API v2.0+ – /me/friends returns empty, or only friends who also use my application

    Login or Signup to reply.
  2. There is another way can give you an access to your all friend list names by downloading a copy of your facebook information data by selecting friends and following checkbox and wait till your file is ready then download it.

    Login or Signup to reply.
  3. This is not the API way but for starters who want one time download list of friends

    1. Go to the friend list page: https://www.facebook.com/friends/list
    2. Scroll all the way down so that all friend list loads
    3. Press F12 to open developer tools, click on console tab
      firefox developer tools console firefox

    A. Show in console
    copy paste following script in console and hit enter.

        var accumulated = "";
        for (var el of document.querySelectorAll('[data-visualcompletion="ignore-dynamic"]')) {
            var name = el.getAttribute("aria-label");
            if(name!= null && name != "null"){
                accumulated = "Name:"+name +", "+ accumulated;
                console.log(accumulated);
                accumulated = "";
            }else{
                var a = el.getElementsByTagName("a")[0];
                if(a){
                    accumulated += "Profile URL: "+ a.getAttribute("href");
                    //console.log(a);
                }
            }
        }
    

    B. Download a .json file
    copy paste following script in console and hit enter.

        var exportObj = [];
        var accumulated = "";
        for (var el of document.querySelectorAll('[data-visualcompletion="ignore-dynamic"]')) {
            var name = el.getAttribute("aria-label");
            if(name!= null && name != "null"){
                exportObj.push({name: name, profileURL: accumulated});
                accumulated = "";
            }else{
                var a = el.getElementsByTagName("a")[0];
                if(a){
                    accumulated += a.getAttribute("href");
                }
            }
        }
        
        var dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(exportObj));
        var downloadAnchorNode = document.createElement('a');
        downloadAnchorNode.setAttribute("href",     dataStr);
        downloadAnchorNode.setAttribute("download", "friendsList.json");
        document.body.appendChild(downloadAnchorNode);
        downloadAnchorNode.click();
        downloadAnchorNode.remove();
    

    Note: pseudo code tested in firefox

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search