JavaScript: Remove all members from an old Facebook Group in bulk

蓝咒 提交于 2019-12-11 16:14:56

问题


I am the admin of a several-years-old Facebook group that has since been overrun by scam accounts (700 or so of them). There are far too many members for me to, realistically, manually remove them - as Facebook recommends.

Here is the link to the group: https://www.facebook.com/groups/101697209943412

I understand that many websites offer JavaScript to perform member removal in bulk; however, I also understand that most of these scripts are toxic and can give control of your page to their developers/other people.

I thought I'd ask StackOverflow for a clean batch of code, in hopes that the community here has more integrity than the internet at large.


回答1:


Try this

var j = 4;
function kickAll() {
   document.getElementsByClassName("_55pe")[j].click();
   setTimeout(function() { document.getElementsByClassName("_54nh")[1].click(); }, 3500);
   setTimeout(function() { document.getElementsByClassName("_42ft _4jy0 layerConfirm uiOverlayButton _4jy3 _4jy1 selected _51sy")[0].click(); }, 6000);
   j++;
   setTimeout(function() { wait(); }, 10000);
}

function wait() {
   if(document.getElementsByClassName("_42ft _4jy0 layerConfirm uiOverlayButton _4jy3 _4jy1 selected _51sy")[0] == undefined) { kickAll(); }
   else { document.getElementsByClassName("_54nh")[1].click(); wait(); }
}

kickAll();

Also, when in the console you might get an error 'document is not defined', if so, check that the top-left dropdown box is set to '<top frame>'



来源:https://stackoverflow.com/questions/35024262/javascript-remove-all-members-from-an-old-facebook-group-in-bulk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!