Advertisement
zucxk

Facebook Tool: Remove Inactive friends

Mar 18th, 2019
675
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Facebook Tool: Remove Inactive friends
  3.  * @author Rifqi Haidar <fb.com/alitguy>
  4.  */
  5. javascript:void(function(){var f=(new Date).getFullYear(),d=prompt("Your access token","EAAAAUaZA.."),g=prompt("Minimum active in years?",f.toString()),c=function(a,b){console.log("%c"+a,"color:"+b)};""==d||null==d?alert("Please enter your access token!"):fetch("https://graph.facebook.com/me/friends?fields=id,name&limit=5000&access_token="+d).then(function(a){return a.json()}).then(function(a){if(a&&a.data&&0!=a.data.length)for(x in a.data)fetch("https://graph.facebook.com/"+a.data[x].id+"/feed?fields=created_time&limit=1&access_token="+d).then(function(a){return a.json()}).then(function(b){if(b&&b.data&&b.data[0]&&b.data[0].created_time){var e=b.data[0].created_time.substr(0,4);e<g?fetch("https://graph.facebook.com/me/friends?uid="+a.data[x].id+"&access_token="+d+"&method=delete").then(function(a){return a.json()}).then(function(b){b?c(a.data[x].name+" ("+a.data[x].id+") => Inactive since "+e+", unfriend success!","green"):c(a.data[x].name+" ("+a.data[x].id+") => Inactive since "+e+", "+b.error.message,"red")}).catch(function(a){c(a,"red")}):c(a.data[x].name+" ("+a.data[x].id+") => Active friend","dodgerblue")}else c(b.error.message,"red")}).catch(function(a){c(a,"red")});else c(a.error.message,"red")}).catch(function(a){c(a,"red")})})()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement