-
-
Save kencarino/3be7c5ee0bec39da99a05639c0fc2673 to your computer and use it in GitHub Desktop.
/** | |
* | |
* This script will remove all group members displayed on group page except admins. | |
* | |
* @author: Nir Geier | |
* @modified: Ken Carino | |
* | |
* Updated May 29, 2019 - Tested on Chrome Version 74.0.3729.169 | |
* | |
* Requirements: | |
* 1. Facebook must use english as language | |
* | |
* Usage: | |
* Load as many users in group members page, then open console and paste this script in the | |
* console. All members loaded in the page will be deleted by this code. | |
* | |
* Once the script finished executing, the page will automatically reload. | |
* | |
* If looking the console doesn't give any feedback of what's happening, reload the | |
* page and repeat again. Take into account that it will delete one user per second, | |
* so it may take a while. | |
* | |
*/ | |
var FBClearGroup = function() { | |
/** | |
* Var initialization | |
*/ | |
var memberSettings, removeLinks, timer; | |
/** | |
* This will grab all remove links available on the page | |
*/ | |
function grabRemoveLink() { | |
memberSettings = Array.prototype.slice.call(document.querySelectorAll("button[aria-label='Member Settings']")); | |
// Expose all the remove users links except the first one, which is the admin | |
var i = 0; | |
var adminsNum = 1; | |
memberSettings.forEach(function(item) { | |
i = i + 1; | |
if (i <= (adminsNum*2)) { | |
return; | |
} | |
item.click(); | |
document.querySelectorAll('a[data-testid="leave_group"]')[0].click(); | |
}); | |
console.log('Getting all remove links...'); | |
// continue with the delete flow | |
timer = setTimeout(removeMember, 10000); | |
} | |
/** | |
* This function will trigger remove buttons | |
*/ | |
function removeMember() { | |
clearTimeout(timer); | |
var confirmButton = Array.prototype.slice.call(document.querySelectorAll('button.layerConfirm.uiOverlayButton')); | |
var i = 1; | |
confirmButton.forEach(function(item) { | |
console.log(item); | |
setTimeout(function() { | |
item.click(); | |
console.log('Removing member...'); | |
}, i * 1000); | |
i = i + 1; | |
}); | |
// Reload the page after everything is finished + 7 seconds | |
setTimeout(function() { | |
window.location.reload(false); | |
}, (i + 7) * 1000); | |
} | |
grabRemoveLink(); | |
}(); |
Hi @Pankekus, this script is only designed for deleting group members and is not eligible for unbanning group members. Have a great day ahead!
Will it work if i go the site with inactive members? I really want to delete all my inactive members, but not all :)
This needs to be fixed. It will delete several members, then Facebook will stop the code. Then you have to paste the code again and run it and keep doing it over and over.
Hi @KeviinCosmos, right now the script will delete members whether active or inactive.
مرحبا انا بحاجه مساعدة
لا اعرف كيف الاستخدلم هل يمكنك مساعدتي
Hi, I tried the skript in chrome and firefox on osx and i doesn't seem to work at all. The Java-console responds with:
VM1834:24 Getting all remove links...
undefined
VM1834:36 Open dialog
a couple seconds later the page reloads and no user is deleted. Any ideas ?
Edit -> I found the Problem: Facebook needs to be in English.
Your script is good for Opera, chrome(i have doubt) if i am right but not for Mozilla since it uses the strong webkit url expansion which messed the whole UI layout that i have tested, but sometimes its just a flash of light which turns black. so add the numeric code functions that allow user input and the code will be fine
@kencarino, Can you help?
Please update this.
@kencarino
Oops, I wasn't receiving notification about your comments. Will post here a new update. Thank you all for letting me know about the issue. Cheers!
@kencarino any news?
not working .. please update it. i cannot find updated code anywhere and this is urgent...thanks...
Hi everyone,
For all who are waiting for the update, I just had some time to update the code today due to my work.
The new update has been tested only to the Chrome browser at the moment.
Please let me know if the new update works on your end or if ever you encounter any issues.
Thank you and have a wonderful day!
@kencarino
have the same chrome version as yours, scripts opens a window to confirm the first user to delete.
then it exit.
Not working for me. any ideas ? I am a second administrator in aditional to the super admin in the group (asked mr to close the group).
Any ideas ?
kencarino have the code updated?
@kencarino
have the same chrome version as yours, scripts opens a window to confirm the first user to delete.
then it exit.
Not working for me. any ideas ? I am a second administrator in aditional to the super admin in the group (asked mr to close the group).
Any ideas ?
Hi @TheGreatGigi, is there any error message showing in the console where you pasted the code? If so, can share it here, the error message will help me identify the issue to fix. Thank you
kencarino have the code updated?
@crisdelcasp1098 yes, the code has been updated. Kindly let us know if it works on your end or not. Thank you and have a good day!
kencarino have the code updated?
@crisdelcasp1098 yes, the code has been updated. Kindly let us know if it works on your end or not. Thank you and have a good day!
now using another PC.
chrome Version 75.0.3770.90 (Official Build) (64-bit)
I am using the latest code. we are 2 administrators. I am NOT the super Admin.
Now when I run the script, It openes only one "remove" window, and deletes the first non admin user, but then it is refreshed exits .
From one hand I see it "catches 15 elements in the group , but it appears only one "remove" window is being opened.
works in opera
have a script to delete massive goup post?
Tried it on Opera too.
Same result. It deletes the first member who is not an admin, wait 10 secs, refresh and exit, instead of deleted the next member.
It removed the admins :( not others..chrome
Removes one member (not admin, which is good, since I should be the last).... THEN it returns an error message and the process stops.
Here is the error:
jquery-1.8.2.min.js:2 Cross-Origin Read Blocking (CORB) blocked cross-origin response https://api.ipify.org/?format=json with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details.
no longer works with any browser
Hi, this script no longer works. It delete only the first member, then reload the page and the process stops.
hello,
is it possible to change the code so, it skips the admins, moderators and the pre-approved members? for example to start deleting from member number 100 so it skips the admins and moderators and preapproved lists?
or to delete only members added on exact dates ?
thanks
Hello, is a modification for unbanning all group members possible? Have a good day!