Last active
January 3, 2025 13:27
-
-
Save nirgeier/7c3950db8f23e67b155a to your computer and use it in GitHub Desktop.
Delete all facebook group members on a given page. Usage: Copy this script, open developers console (F12) in chrome (win) and paste this script. The script will delete all the members that you can see in the given page. Once the script is done you should see a blank members page,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This script will delete all group members which are displayed in a given page. | |
* | |
* @author: Nir Geier | |
* | |
* Usage: | |
* Load as many users as you need, then open console and paste this script in teh console. | |
* Once the script finished executing you will be see blank members page, reload the next | |
* page and start the process again. | |
* | |
* !!! Important | |
* Sometimes after opening teh confirm dialog the page look "freeze" for a while | |
* Its OK and it takes time to remove all users. | |
* | |
* If the page doen not return the members list page after few minutes, refresh the page and execute the script again | |
*/ | |
var FBClearGroup = function() { | |
// Get all the Admins settings buttons | |
var memberSettings, removeLinks, timer; | |
/** | |
* This function will click on all the uses admin settings buttons to add the remove link to the page dom | |
*/ | |
function exposeRemoveLinks() { | |
memberSettings = Array.prototype.slice.call(document.querySelectorAll('.adminActions [role="button"]')); | |
// Expose all the remove users links | |
memberSettings.forEach(function(item) { | |
item.click(); | |
}); | |
// continue with the delete flow | |
timer = setTimeout(openRemoveDialog, 1000); | |
} | |
/** | |
* This function will display the remove dialog | |
*/ | |
function openRemoveDialog() { | |
clearTimeout(timer); | |
// Grab all the remove links | |
removeLinks = Array.prototype.slice.call(document.querySelectorAll("a[href*='remove.php']")); | |
// Verify that the previous step has completed | |
// The -1 is the number of the admins in the gorup. | |
if (removeLinks.length < memberSettings.length-1) { | |
// wait for previous step to complete | |
timer = setTimeout(openRemoveDialog, 1000); | |
} else { | |
// Open all the remove dialog | |
removeLinks.forEach(function(item) { | |
item.click(); | |
}); | |
// delete the users | |
timer = setTimeout(removeUsers, 1000); | |
} | |
} | |
/** | |
* This method will click on the remove user and will remove the user form group | |
*/ | |
function removeUsers() { | |
// Grab all the confirm buttons | |
var confirmButton = Array.prototype.slice.call(document.querySelectorAll('.layerConfirm.uiOverlayButton[type="submit"]')); | |
// Verify that the previous step has completed | |
if (confirmButton.length < memberSettings.length) { | |
timer = setTimeout(removeUsers, 1000); | |
} else { | |
// Click on the remove confirm button | |
confirmButton.forEach(function(item) { | |
item.click(); | |
}); | |
} | |
} | |
exposeRemoveLinks(); | |
}(); |
@kencarino, your solution isn't working for me anymore, either. :(
not working as of 25 may 2019. please update it. thanks :)
new script?????
??
hi, is still working? is there a way to load more than 200 members in the group?
Hello thank you for this.
Can you customize the script we can delete only the inactive facebook group members?
Cheers
Above solutions doesn't work as of the moment. I forked your code to make the solution working:
https://gist.github.com/kencarino/3be7c5ee0bec39da99a05639c0fc2673
Hello Kencarino, would you be able to adapt the code in unavailable member section of a group, all the disabled members can be deleted automatically? I would be happy to give you some money for that.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Above solutions doesn't work as of the moment. I forked your code to make the solution working:
https://gist.github.com/kencarino/3be7c5ee0bec39da99a05639c0fc2673