Skip to content

Instantly share code, notes, and snippets.

@jayremnt
Last active August 2, 2021 13:04
Show Gist options
  • Save jayremnt/ef8291b77f762fd2892f29ed444e9a8f to your computer and use it in GitHub Desktop.
Save jayremnt/ef8291b77f762fd2892f29ed444e9a8f to your computer and use it in GitHub Desktop.
Unfollow all users and pages
/*
Script by JayremntB, 2020
Unfollow all users and pages
Please copy all the code to make sure that you will not get any errors
Before run this script, please navigate to https://www.facebook.com/(your-username)/following
*/
// You can change time delay below or not (in milliseconds, 1 s = 1000 ms)
let delayTime = 0;
// process, please don't modify
let _0x8159=['data','send','all_collections','string','text','forEach','keys','Starting...','payloads','pathname','log','Get\x20list\x20following...','concat','👌\x20DONE!','node','then','nodes','RelayModern','rootView','Please\x20check\x20the\x20URL\x20again\x20if\x20you\x20did\x20not\x20navigate\x20to:\x20https://www.facebook.com/(your-username)/following','search','end_cursor','catch','c_user','Error:\x20','---------------------------','Please\x20navigate\x20to\x20\x22https://www.facebook.com/(your-username)/following\x22\x20before\x20run\x20this\x20script.','onreadystatechange','GET','Script\x20by\x20JayremntB,\x202020','result','PROFILE','https://www.facebook.com/ajax/bulk-route-definitions/','Unfollow\x20all\x20users\x20who\x20are\x20not\x20your\x20friends\x20and\x20pages','responseText','WWW_COMET_PROFILE','open','ProfileCometAppCollectionListRendererPaginationQuery','collectionToken','length','POST','append','collection','Prepare\x20to\x20unfollow...','user','includes','slice','location','find','sectionToken','token','payload','CometUserUnfollowMutation','\x20users.\x20','👉\x20Unfollowed\x20','stringify','page_info','responseType','props','parse','\x20remaining...','pageItems','DTSGInitialData','https://www.facebook.com/api/graphql/','has_next_page','status','style_renderer','timeline_nav_app_sections'];(function(_0x1fee53,_0x81597b){let _0x2c2042=function(_0x48440c){while(--_0x48440c){_0x1fee53['push'](_0x1fee53['shift']());}};_0x2c2042(++_0x81597b);}(_0x8159,0x171));let _0x2c20=function(_0x1fee53,_0x81597b){_0x1fee53=_0x1fee53-0x0;let _0x2c2042=_0x8159[_0x1fee53];return _0x2c2042;};let _0x489994=_0x2c20;let fbDtsg=require(_0x489994('0x21'))[_0x489994('0x15')],uid=document['cookie']['split'](';')[_0x489994('0x13')](_0x48440c=>_0x48440c[_0x489994('0x10')](_0x489994('0x3e')))['split']('=')[0x1];(()=>{let _0x400dee=_0x489994;console[_0x400dee('0x31')](_0x400dee('0x0')),console[_0x400dee('0x31')](_0x400dee('0x4')),console['log'](_0x400dee('0x41')),console[_0x400dee('0x31')](_0x400dee('0x40')),console[_0x400dee('0x31')](_0x400dee('0x2e')),getFollowingRouteInfo()[_0x400dee('0x36')](_0x5dd79b=>{let _0x2ccd94=_0x400dee;return console[_0x2ccd94('0x31')](_0x2ccd94('0x32')),getAllFollowing(_0x5dd79b,0x1f4);})[_0x400dee('0x36')](_0x9d874f=>{let _0x1cd312=_0x400dee;let _0x67a193=[];_0x9d874f[_0x1cd312('0x2c')](_0x3d4a7a=>{_0x67a193['push'](_0x3d4a7a);}),console['log'](_0x67a193['length']+'\x20users\x20will\x20be\x20unfollowed...'),console[_0x1cd312('0x31')](_0x1cd312('0xe'));let _0x537bcc=0x0;setTimeout(function _0x443e36(){let _0x398812=_0x1cd312;if(_0x537bcc<_0x67a193[_0x398812('0xa')])unfollowNotFriend(_0x67a193[_0x537bcc]['node'][_0x398812('0x35')]['id'])[_0x398812('0x36')](()=>{let _0x3cdd17=_0x398812;console['log'](_0x3cdd17('0x19')+(_0x537bcc+0x1)+_0x3cdd17('0x18')+(_0x67a193[_0x3cdd17('0xa')]-_0x537bcc-0x1)+_0x3cdd17('0x1f')),_0x537bcc++,setTimeout(_0x443e36,delayTime);})[_0x398812('0x3d')](_0x201cf5=>{let _0x4bfce2=_0x398812;console[_0x4bfce2('0x31')](_0x201cf5);});else console[_0x398812('0x31')](_0x398812('0x34'));},0x0);})[_0x400dee('0x3d')](_0x2db182=>{let _0x2923eb=_0x400dee;console['log'](_0x2db182),console['log'](_0x2923eb('0x3a'));});})();function getNextListFollowing(_0x4d956d,_0x53b0e9,_0x473155){return new Promise((_0x537666,_0x2c3eee)=>{let _0x4a48ea=_0x2c20;request('POST',_0x4a48ea('0x22'),{'fb_dtsg':fbDtsg,'fb_api_caller_class':_0x4a48ea('0x38'),'fb_api_req_friendly_name':_0x4a48ea('0x8'),'variables':{'count':_0x473155,'cursor':_0x53b0e9,'scale':0x1,'search':null,'id':_0x4d956d[_0x4a48ea('0x9')]},'doc_id':0xabdd4b9c393ee})[_0x4a48ea('0x36')](_0x2955c1=>{let _0x7ccb68=_0x4a48ea;try{_0x2955c1=JSON[_0x7ccb68('0x1e')](_0x2955c1),_0x537666(_0x2955c1[_0x7ccb68('0x27')]['node']['pageItems']);}catch(_0x5dc344){_0x2c3eee(_0x5dc344);}})[_0x4a48ea('0x3d')](_0x2c3eee);});}function getAllFollowing(_0x453c9b,_0x131dd2){return new Promise((_0x4efc5d,_0x32e1bf)=>{let _0xfbca93=_0x2c20;request(_0xfbca93('0xb'),_0xfbca93('0x22'),{'fb_dtsg':fbDtsg,'fb_api_caller_class':_0xfbca93('0x38'),'fb_api_req_friendly_name':'ProfileCometTopAppSectionQuery','variables':{'collectionToken':_0x453c9b[_0xfbca93('0x9')],'scale':0x1,'sectionToken':_0x453c9b[_0xfbca93('0x14')],'userID':uid},'doc_id':0xbf03dcd6ed9ef})[_0xfbca93('0x36')](_0x5c960a=>{let _0x520438=_0xfbca93;try{_0x5c960a=JSON[_0x520438('0x1e')](_0x5c960a);let _0x7c32c4=_0x5c960a[_0x520438('0x27')][_0x520438('0xf')][_0x520438('0x26')][_0x520438('0x37')][0x0][_0x520438('0x29')][_0x520438('0x37')][0x0][_0x520438('0x25')][_0x520438('0xd')][_0x520438('0x20')];let _0xcaee22=_0x7c32c4['edges'],_0x4dc58e=_0x7c32c4[_0x520438('0x1b')];setTimeout(function _0x496b00(_0x5577bd=_0x4dc58e[_0x520438('0x3c')]){let _0x3689ae=_0x520438;getNextListFollowing(_0x453c9b,_0x5577bd,_0x131dd2)['then'](_0xf74aa2=>{let _0x2b8cee=_0x2c20;_0xcaee22=_0xcaee22[_0x2b8cee('0x33')](_0xf74aa2['edges']);if(!_0xf74aa2[_0x2b8cee('0x1b')][_0x2b8cee('0x23')]){_0x4efc5d(_0xcaee22);return;}return setTimeout(_0x496b00(_0xf74aa2[_0x2b8cee('0x1b')][_0x2b8cee('0x3c')]),0x0);})[_0x3689ae('0x3d')](_0x32e1bf);},0x0);}catch(_0xa3fbab){_0x32e1bf(_0xa3fbab);}})['catch'](_0x32e1bf);});}function getFollowingRouteInfo(){return new Promise((_0x1db457,_0x579e9c)=>{let _0xc553d6=_0x2c20;request(_0xc553d6('0xb'),_0xc553d6('0x3'),{'fb_dtsg':fbDtsg,'route_urls[0]':window[_0xc553d6('0x12')][_0xc553d6('0x30')]+window[_0xc553d6('0x12')][_0xc553d6('0x3b')]})['then'](_0x25113d=>{let _0x32116b=_0xc553d6;try{_0x25113d=JSON[_0x32116b('0x1e')](_0x25113d[_0x32116b('0x11')](0x9));let _0x53849a=Object[_0x32116b('0x2d')](_0x25113d[_0x32116b('0x16')]['payloads'])[0x0],_0x1535ef=_0x25113d[_0x32116b('0x16')][_0x32116b('0x2f')][_0x53849a][_0x32116b('0x1')]['exports'][_0x32116b('0x39')][_0x32116b('0x1d')];_0x1db457(_0x1535ef);}catch(_0x2cddb3){_0x579e9c(_0x2cddb3);}})[_0xc553d6('0x3d')](_0x579e9c);});}function unfollowNotFriend(_0x4139ee){return new Promise((_0x58cde2,_0x3b2a9c)=>{let _0x4dcdb1=_0x2c20;request(_0x4dcdb1('0xb'),_0x4dcdb1('0x22'),{'fb_dtsg':fbDtsg,'fb_api_caller_class':_0x4dcdb1('0x38'),'fb_api_req_friendly_name':_0x4dcdb1('0x17'),'variables':{'action_render_location':_0x4dcdb1('0x6'),'input':{'subscribe_location':_0x4dcdb1('0x2'),'unsubscribee_id':_0x4139ee,'actor_id':uid,'client_mutation_id':'7'},'scale':0x1},'doc_id':0xd1a57d1fa7da0})[_0x4dcdb1('0x36')](_0x58cde2)[_0x4dcdb1('0x3d')](_0x3b2a9c);});}function request(_0x41d941,_0x457de1,_0x29c5ec){let _0x2e1be1=_0x489994;let _0x119111=new FormData();if(_0x41d941===_0x2e1be1('0xb'))for(let _0x674854 in _0x29c5ec){_0x119111[_0x2e1be1('0xc')](_0x674854,typeof _0x29c5ec[_0x674854]===_0x2e1be1('0x2a')?_0x29c5ec[_0x674854]:JSON[_0x2e1be1('0x1a')](_0x29c5ec[_0x674854]));}else{if(_0x41d941===_0x2e1be1('0x43')&&typeof _0x29c5ec!=='undefined'){_0x457de1+='?';for(let _0x453dfc in _0x29c5ec){_0x457de1+=_0x453dfc+'='+encodeURI(_0x29c5ec[_0x453dfc])+'&';}}}return new Promise((_0x48434f,_0x594fb1)=>{let _0x59ae3a=_0x2e1be1,_0xe92bed=new XMLHttpRequest();_0xe92bed[_0x59ae3a('0x1c')]=_0x59ae3a('0x2b');try{_0xe92bed[_0x59ae3a('0x7')](_0x41d941,_0x457de1),_0xe92bed[_0x59ae3a('0x28')](_0x119111),_0xe92bed[_0x59ae3a('0x42')]=function(){let _0x1458d3=_0x59ae3a;if(_0xe92bed['readyState']===0x4){if(_0xe92bed[_0x1458d3('0x24')]!==0xc8)_0x594fb1(_0x1458d3('0x3f')+_0xe92bed[_0x1458d3('0x24')]);else _0x48434f(_0xe92bed[_0x1458d3('0x5')]);}};}catch(_0x3706d2){_0x594fb1(_0x3706d2);}});}
@Hoanghuys9
Copy link

Script by JayremntB, 2020
Unfollow all users and pages
Please copy all the code to make sure that you will not get any errors
Before run this script, please navigate to https://www.facebook.com/(your-username)/following

@Hoanghuys9
Copy link

Ok

@Hoanghuys9
Copy link

Ok

@nguyenhobac
Copy link

Errors appeared, please check, thanks

Script by JayremntB, 2020
VM2134:31 Unfollow all users who are not your friends and pages
VM2134:31 Please navigate to "https://www.facebook.com/(your-username)/following" before run this script.
VM2134:31 ---------------------------
VM2134:31 Starting...
undefined
VM2134:33 Get list following...
VM2134:54 SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at :76:40
VM2134:54 Please check the URL again if you did not navigate to: https://www.facebook.com/(your-username)/following

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment