Tuesday, May 1, 2012

Deleteting All Facebook friend programmatically using fb graph api, mobile fb site, & jQuery + firequery

$.ajax({
  url: "https://graph.facebook.com/me/friends?access_token=AAAAAAITEghMBABoxQhYsFHaMdnQJgJ1BoDbedvjJdadnwsNPJlZBrQcO0n1FUDg68UZCSJZAtV4rorKr1iOBchJSkLiXY2Gizgz8CdsyyyMmPeG6uvX", // get this at http://developers.facebook.com/docs/reference/api/ take the Friends link and replace it.
  success: function(data) {
    console.log(data)
        jQuery.each(data.data, function() {
            $("input[name=friend_id]").val(this.id)
            $("form:first").serialize()
            $.ajax({
                url: "http://m.facebook.com/a/removefriend.php",
                data: $("form:first").serialize(),
                type: "post"
            })
        });
  },
  dataType: "json"
});
 
Use the fb mobile page (where we have confirm delete friend button) to execute this script.

We need firebug & firequery to jquerify this page before we can execute this script.

Basically, this script will fetch your friend id from the fb graph api & submit the confirm delete friend form using each friend id that it fetched.

2 comments:

  1. Commencing at $900, the ten.6-inch Surface area Professional is windows 7 home premium product key astronomical for any tablet. Despite the fact that it’s definitely a tablet-ultrabook windows 7 ultimate activation key hybrid of sorts, it truly is perceived as being a pill.

    ReplyDelete
  2. How about delete all the friends who choose to unfollow my posts or have never liked my posts for the past 1 year?

    ReplyDelete