-
-
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(); | |
}(); |
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
have a script to delete massive goup post?