Skip to content

Instantly share code, notes, and snippets.

@jayremnt
Last active December 2, 2020 01:59
Show Gist options
  • Save jayremnt/2f7a967da97e748e1200080d3d8e9196 to your computer and use it in GitHub Desktop.
Save jayremnt/2f7a967da97e748e1200080d3d8e9196 to your computer and use it in GitHub Desktop.
/*
Script by JayremntB, 2020
Delete page's posts
Please copy all the code to make sure that you will not get any errors
*/
// process, please don't modify
let accessToken = "";
let pageID = "";
let postsLimit = 1000000;
//
let _0x1e0b=['forEach','useCometFeedStoryDeleteMutation','data','<-----\x20Số\x20bài\x20viết\x20đã\x20xoá','cookie','send','find','\x20bài\x20viết.\x20Vẫn\x20đang\x20load...','paging','PERMALINK','log','/posts','onreadystatechange','status','catch','DONE!','open','Error:\x20','Đã\x20load\x20','Script\x20by\x20JayremntB,\x202020','string','responseText','token','responseType','includes','split','stringify','push','GET','c_user','then','qpl_active_flow_ids=55246849','POST','next','parse','undefined'];(function(_0x46b579,_0x1e0bc4){let _0x37ee2c=function(_0x471141){while(--_0x471141){_0x46b579['push'](_0x46b579['shift']());}};_0x37ee2c(++_0x1e0bc4);}(_0x1e0b,0x78));let _0x37ee=function(_0x46b579,_0x1e0bc4){_0x46b579=_0x46b579-0x0;let _0x37ee2c=_0x1e0b[_0x46b579];return _0x37ee2c;};let _0x5dc1ea=_0x37ee;let fbDtsg=require('DTSGInitialData')[_0x5dc1ea('0xa')],uid=document[_0x5dc1ea('0x1c')][_0x5dc1ea('0xd')](';')[_0x5dc1ea('0x1e')](_0x471141=>_0x471141[_0x5dc1ea('0xc')](_0x5dc1ea('0x11')))[_0x5dc1ea('0xd')]('=')[0x1];(()=>{let _0x86c5a9=_0x5dc1ea;console[_0x86c5a9('0x22')](_0x86c5a9('0x7')),console[_0x86c5a9('0x22')]('Delete\x20page\x27s\x20posts'),console[_0x86c5a9('0x22')]('---------------------------'),getPostIDs(pageID,postsLimit)[_0x86c5a9('0x12')](_0x34c8d0=>{let _0x383312=_0x86c5a9;let _0xfa9ebb=[];_0x34c8d0[_0x383312('0x18')](_0x2c5a39=>_0xfa9ebb[_0x383312('0xf')](deletePost(uid,_0x2c5a39))),Promise['all'](_0xfa9ebb)[_0x383312('0x12')](()=>{let _0x5f3bf9=_0x383312;console[_0x5f3bf9('0x22')](_0x5f3bf9('0x3'));})[_0x383312('0x2')](_0x1bd70d=>console[_0x383312('0x22')](_0x1bd70d));})['catch'](_0x271a4e=>console[_0x86c5a9('0x22')](_0x271a4e));})();function getPostIDs(_0x4504c9,_0x19dd85){return new Promise((_0x382cc9,_0xc46e59)=>{let _0x467fb0=_0x37ee;request(_0x467fb0('0x10'),'https://graph.facebook.com/'+_0x4504c9+_0x467fb0('0x23'),{'access_token':accessToken,'fields':'id','limit':0x64})[_0x467fb0('0x12')](_0x17a8f7=>{let _0x17f811=_0x467fb0;let _0x265291=[];try{_0x17a8f7=JSON[_0x17f811('0x16')](_0x17a8f7),_0x17a8f7[_0x17f811('0x1a')][_0x17f811('0x18')](_0x11ec1f=>{_0x265291['push'](_0x11ec1f['id']['split']('_')[0x1]);}),setTimeout(function _0x22d186(_0x975b17=_0x17a8f7[_0x17f811('0x20')][_0x17f811('0x15')]){let _0x2b7a8b=_0x17f811;console[_0x2b7a8b('0x22')](_0x2b7a8b('0x6')+_0x265291['length']+_0x2b7a8b('0x1f'));if(_0x975b17!==null&&_0x975b17!==undefined&&_0x265291['length']<_0x19dd85)request('GET',_0x975b17)[_0x2b7a8b('0x12')](_0x403402=>{let _0x446bd9=_0x2b7a8b;_0x403402=JSON['parse'](_0x403402),_0x403402['data'][_0x446bd9('0x18')](_0x5a6945=>{let _0x54a0ba=_0x446bd9;_0x265291[_0x54a0ba('0xf')](_0x5a6945['id'][_0x54a0ba('0xd')]('_')[0x1]);}),setTimeout(_0x22d186(_0x403402[_0x446bd9('0x20')][_0x446bd9('0x15')]===undefined?null:_0x403402[_0x446bd9('0x20')][_0x446bd9('0x15')]),0x2710);});else _0x382cc9(_0x265291);});}catch(_0x50d8c7){console[_0x17f811('0x22')](_0x50d8c7),_0x382cc9(_0x265291);}})[_0x467fb0('0x2')](_0xc46e59);});}function deletePost(_0x26bb5d,_0x4360f7){return new Promise((_0x5c0590,_0x19de5e)=>{let _0x3f32e9=_0x37ee;request(_0x3f32e9('0x14'),'https://www.facebook.com/api/graphql/',{'fb_dtsg':fbDtsg,'fb_api_caller_class':'RelayModern','fb_api_req_friendly_name':_0x3f32e9('0x19'),'variables':{'input':{'story_id':btoa('S:_I'+_0x26bb5d+':'+_0x4360f7),'story_location':_0x3f32e9('0x21'),'actor_id':_0x26bb5d,'client_mutation_id':'5'}},'fb_api_analytics_tags':[_0x3f32e9('0x13')],'doc_id':0x988135ceb03be})[_0x3f32e9('0x12')](()=>{let _0x92b46a=_0x3f32e9;console['log'](_0x92b46a('0x1b')),_0x5c0590();})[_0x3f32e9('0x2')](_0x19de5e);});}function request(_0x3eea23,_0x3923cb,_0x5c1227){let _0x5b5b10=_0x5dc1ea;let _0x320272=new FormData();if(_0x3eea23===_0x5b5b10('0x14'))for(let _0x1aaf89 in _0x5c1227){_0x320272['append'](_0x1aaf89,typeof _0x5c1227[_0x1aaf89]===_0x5b5b10('0x8')?_0x5c1227[_0x1aaf89]:JSON[_0x5b5b10('0xe')](_0x5c1227[_0x1aaf89]));}else{if(_0x3eea23===_0x5b5b10('0x10')&&typeof _0x5c1227!==_0x5b5b10('0x17')){_0x3923cb+='?';for(let _0xf0eab5 in _0x5c1227){_0x3923cb+=_0xf0eab5+'='+encodeURI(_0x5c1227[_0xf0eab5])+'&';}}}return new Promise((_0x2e31de,_0x5bec40)=>{let _0x3b9e53=_0x5b5b10,_0xa60f3c=new XMLHttpRequest();_0xa60f3c[_0x3b9e53('0xb')]='text';try{_0xa60f3c[_0x3b9e53('0x4')](_0x3eea23,_0x3923cb),_0xa60f3c[_0x3b9e53('0x1d')](_0x320272),_0xa60f3c[_0x3b9e53('0x0')]=function(){let _0x2071dd=_0x3b9e53;if(_0xa60f3c['readyState']===0x4){if(_0xa60f3c[_0x2071dd('0x1')]!==0xc8)_0x5bec40(_0x2071dd('0x5')+_0xa60f3c[_0x2071dd('0x1')]);else _0x2e31de(_0xa60f3c[_0x2071dd('0x9')]);}};}catch(_0x30d9ee){_0x5bec40(_0x30d9ee);}});}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment