Skip to content

Instantly share code, notes, and snippets.

@ducan-ne
Last active February 24, 2019 04:49
Show Gist options
  • Save ducan-ne/5cb15c8f432d2be1c6fdb66ff89df030 to your computer and use it in GitHub Desktop.
Save ducan-ne/5cb15c8f432d2be1c6fdb66ff89df030 to your computer and use it in GitHub Desktop.

Revisions

  1. ducan-ne revised this gist Sep 15, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends")||console.log("# can't remove",a.filter(a=>!a).length," friends")),console.log("created with ❤ by ancMS".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/,list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=Math.pow(10,(this.friends.length+[]).length-1),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    javascript:(function([,c]){return c.uid?void(console.log('#','hello ',c.info.NAME),Promise.resolve().then(c.getFriends.bind(c)).then(d=>d.removeFriends()).then(d=>console.log('# removed',d.filter(Boolean).length,' friends')||console.log('# can\'t remove',d.filter(f=>!f).length,' friends')),console.log('created with \u2764 by Duc An'.concat('\n','https://ancms.systems/','\n','https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030'))):console.log('# login required')})([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch('/ajax/typeahead/first_degree.php',{qs:{viewer:this.uid,'filter[0]':'user','options[0]':'friends_only',__user:this.uid,__a:1,__pc:'PHASED:DEFAULT'}}).then(c=>c.text()).then(c=>JSON.parse(c.substr(9)).payload.entries.map(d=>d.uid)).then(c=>{return this.friends=[...new Set(require('InitialChatFriendsList').list.map(d=>parseInt(d.replace(/-[0-9]$/,''))))].filter(d=>!!!c.includes(d)),this})},delay(){let c=Array.from(arguments).shift();return new Promise(d=>{setTimeout(()=>d(),c)})},removeFriends(){return this.success=0,this.speed=Math.pow(10,(this.friends.length+[]).length-1),Promise.all(this.friends.map((c,d)=>this.delay(++d*this.speed).then(()=>this.remove(c)).then(f=>{return f&&console.log('# removed',c,`${(100*(++this.success/this.friends.length)).toFixed(2)}%`),f})))},remove(){let c=Array.from(arguments).pop(),d=new FormData;return d.append('fb_dtsg',this.fb_dtsg),d.append('__user',this.uid),d.append('uid',c),d.append('unref','bd_friends_tab'),d.append('__a','-1'),d.append('__af','iw'),d.append('__be','-1'),d.append('__pc','PHASED:DEFAULT'),this.fetch('/ajax/profile/removefriendconfirm.php',{method:'POST',body:d}).then(f=>f.text()).then(f=>!!!JSON.parse(f.substr(9)).error)},fetch(c,d){return fetch(`${c}?${this.http_build_query(d.qs||{})}`,Object.assign({},{credentials:'include'},d))},http_build_query:c=>Object.keys(c).reduce((d,f)=>d.push([f,c[f]].map(encodeURIComponent).join('='))&&d,[]).join('&'),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert('Please log in facebook before remove friends')]).pop(),fb_dtsg:(require('DTSGInitialData')||{}).token,info:require('CurrentUserInitialData')}]);
  2. ducan-ne revised this gist Sep 15, 2017. No changes.
  3. ducan-ne revised this gist Apr 25, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends")||console.log("# can't remove",a.filter(a=>!a).length," friends")),console.log("created with ❤ by ancMS".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=Math.pow(10,(this.friends.length+[]).length-1),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    !function([,a]){if(!a.uid)return console.log("# login required");Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends")||console.log("# can't remove",a.filter(a=>!a).length," friends")),console.log("created with ❤ by ancMS".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/,list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=Math.pow(10,(this.friends.length+[]).length-1),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  4. ducan-ne revised this gist Apr 23, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends")||console.log("# can't remove",a.filter(a=>!a).length," friends")),console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=Math.pow(10,(this.friends.length+[]).length-1),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    !function([,a]){if(!a.uid)return console.log("# login required");Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends")||console.log("# can't remove",a.filter(a=>!a).length," friends")),console.log("created with ❤ by ancMS".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=Math.pow(10,(this.friends.length+[]).length-1),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  5. ducan-ne revised this gist Apr 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends")||console.log("# can't remove",a.filter(a=>!a).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=Math.pow(10,(this.friends.length+[]).length-1),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    !function([,a]){if(!a.uid)return console.log("# login required");Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends")||console.log("# can't remove",a.filter(a=>!a).length," friends")),console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=Math.pow(10,(this.friends.length+[]).length-1),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  6. ducan-ne revised this gist Apr 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=Math.pow(10,(this.friends.length+[]).length-1),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    !function([,a]){if(!a.uid)return console.log("# login required");Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends")||console.log("# can't remove",a.filter(a=>!a).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=Math.pow(10,(this.friends.length+[]).length-1),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  7. ducan-ne revised this gist Apr 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=Math.pow(10,(this.tokens.length+[]).length-1),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=Math.pow(10,(this.friends.length+[]).length-1),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  8. ducan-ne revised this gist Apr 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=100*Math.round(this.tokens.length/100),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=Math.pow(10,(this.tokens.length+[]).length-1),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  9. ducan-ne revised this gist Apr 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,Promise.all(this.friends.map((a,b)=>this.delay(1e3*++b).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,this.speed=100*Math.round(this.tokens.length/100),Promise.all(this.friends.map((a,b)=>this.delay(++b*this.speed).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  10. ducan-ne revised this gist Apr 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,Promise.all(this.friends.map((a,b)=>this.delay(1e3*++b).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${Math.floor(++this.success/this.friends.length*100)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,Promise.all(this.friends.map((a,b)=>this.delay(1e3*++b).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${(++this.success/this.friends.length*100).toFixed(2)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  11. ducan-ne revised this gist Apr 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return Promise.all(this.friends.map((a,b)=>this.delay(1e3*++b).then(()=>this.remove(a)).then(c=>{c&&console.log("# removed",a,`${Math.floor(++b/this.friends.length*100)}%`);return c})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return this.success=0,Promise.all(this.friends.map((a,b)=>this.delay(1e3*++b).then(()=>this.remove(a)).then(b=>{b&&console.log("# removed",a,`${Math.floor(++this.success/this.friends.length*100)}%`);return b})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  12. ducan-ne revised this gist Apr 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return Promise.all(this.friends.map((a,b)=>this.delay(1e3*b).then(()=>this.remove(a)).then(c=>{c&&console.log("# removed",a,`${Math.floor(++b/this.friends.length*100)}%`);return c})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return Promise.all(this.friends.map((a,b)=>this.delay(1e3*++b).then(()=>this.remove(a)).then(c=>{c&&console.log("# removed",a,`${Math.floor(++b/this.friends.length*100)}%`);return c})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  13. ducan-ne revised this gist Apr 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return Promise.all(this.friends.map((a,b)=>this.delay(b*(this.friends.length<1e3?this.friends.length<100?10:100:1e3)).then(()=>this.remove(a)).then(c=>{c&&console.log("# removed",a,`${Math.floor(++b/this.friends.length*100)}%`);return c})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return Promise.all(this.friends.map((a,b)=>this.delay(1e3*b).then(()=>this.remove(a)).then(c=>{c&&console.log("# removed",a,`${Math.floor(++b/this.friends.length*100)}%`);return c})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  14. ducan-ne revised this gist Apr 22, 2017. No changes.
  15. ducan-ne revised this gist Apr 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return Promise.all(this.friends.map((a,b)=>this.delay(1e3*b).then(()=>this.remove(a)).then(c=>{c&&console.log("# removed",a,`${Math.floor(++b/this.friends.length*100)}%`);return c})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return Promise.all(this.friends.map((a,b)=>this.delay(b*(this.friends.length<1e3?this.friends.length<100?10:100:1e3)).then(()=>this.remove(a)).then(c=>{c&&console.log("# removed",a,`${Math.floor(++b/this.friends.length*100)}%`);return c})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  16. ducan-ne revised this gist Apr 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return Promise.all(this.friends.map((a,b)=>this.delay(1e3*b).then(()=>this.remove(a)).then(c=>{c&&console.log("# removed",a,`${Math.floor(++b/this.friends.length*100)}%`);return c})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/ancm-s/5cb15c8f432d2be1c6fdb66ff89df030")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return Promise.all(this.friends.map((a,b)=>this.delay(1e3*b).then(()=>this.remove(a)).then(c=>{c&&console.log("# removed",a,`${Math.floor(++b/this.friends.length*100)}%`);return c})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  17. ducan-ne revised this gist Apr 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    console.log('andeptrai');
    !function([,a]){if(!a.uid)return console.log("# login required");console.log("created with ❤ by Duc An".concat("\n","https://ancms.systems/","\n","https://gist.github.com/")),Promise.resolve().then(a.getFriends.bind(a)).then(a=>a.removeFriends()).then(a=>console.log("# removed",a.filter(Boolean).length," friends"))}([[97,...[110,99,109,115,46,115,121,115,116,101,109,115]],{getFriends(){return this.fetch("/ajax/typeahead/first_degree.php",{qs:{viewer:this.uid,"filter[0]":"user","options[0]":"friends_only",__user:this.uid,__a:1,__pc:"PHASED:DEFAULT"}}).then(a=>a.text()).then(a=>JSON.parse(a.substr(9)).payload.entries.map(a=>a.uid)).then(a=>{this.friends=[...new Set(JSON.parse(document.body.innerHTML.match(/groups:\[\],list:(.*?)\,pageListModule/).pop()).map(a=>parseInt(a.replace(/-[0-9]$/,""))))].filter(b=>!a.includes(b));return this})},delay(){let a=Array.from(arguments).shift();return new Promise(b=>{setTimeout(()=>b(),a)})},removeFriends(){return Promise.all(this.friends.map((a,b)=>this.delay(1e3*b).then(()=>this.remove(a)).then(c=>{c&&console.log("# removed",a,`${Math.floor(++b/this.friends.length*100)}%`);return c})))},remove(){let a=Array.from(arguments).pop(),b=new FormData;return b.append("fb_dtsg",this.fb_dtsg),b.append("__user",this.uid),b.append("uid",a),b.append("unref","bd_friends_tab"),b.append("__a","-1"),b.append("__af","iw"),b.append("__be","-1"),b.append("__pc","PHASED:DEFAULT"),this.fetch("/ajax/profile/removefriendconfirm.php",{method:"POST",body:b}).then(a=>a.text()).then(a=>!JSON.parse(a.substr(9)).error)},fetch(a,b){return fetch(`${a}?${this.http_build_query(b.qs||{})}`,Object.assign({},{credentials:"include"},b))},http_build_query:a=>Object.keys(a).reduce((b,c)=>b.push([c,a[c]].map(encodeURIComponent).join("="))&&b,[]).join("&"),uid:(document.cookie.match(/c_user=([0-9]+)/)||[,alert("Please log in facebook before remove friends")]).pop(),fb_dtsg:(Array.from($$('[name="fb_dtsg"]')||[{value:""}]).shift()||[{value:""}]).value}]);
  18. ducan-ne created this gist Apr 22, 2017.
    1 change: 1 addition & 0 deletions remove-ua-friends.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    console.log('andeptrai');