Skip to content

Instantly share code, notes, and snippets.

@htdat
Created March 4, 2017 15:39
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save htdat/2e9a1229eccbf97c58cb48fbcce08384 to your computer and use it in GitHub Desktop.
Save htdat/2e9a1229eccbf97c58cb48fbcce08384 to your computer and use it in GitHub Desktop.
Delete FB group pending posts for admins
/**
* Please use this file at your own risk. I don't provide the support for it.
* Any suggestion or problem are welcomed to report here :)
*/
/**
* Usage:
* 1. Log-in as an group admin in the desktop
* 2. Go to your group pending list like: https://www.facebook.com/groups/[group-id]/pending/
* 3. Insert the following code to your browser console. See the guide: https://developer.chrome.com/devtools/docs/console
*
* Note:
* - This will delete all posts in your pending list, so please make sure you don't need them any more.
*/
var count_del = 0;
var count_confirm = 0;
var click_del = function () {
//button 'x' delete, class: img sp_WVlmwZ4PzbP sx_8019e2 | img sp_vPWoN8_ZzE7 sx_5cd324 | img sp_uBI2xAARzhd sx_812cfb | img sp_P3HKPeqx6sL sx_f56b15
var inputs_del = document.getElementsByClassName('img sp_WVlmwZ4PzbP sx_8019e2');
for(var i=0; i<inputs_del.length;i++) {
if ( i == 10) { break; };
count_del++;
console.log("Click Delete " + count_del);
inputs_del[i].click();
};
};
var click_confirm = function () {
//button 'Delete' to confirm delete this post
var inputs_confirm = document.getElementsByClassName('_42ft _4jy0 layerConfirm uiOverlayButton _4jy3 _4jy1 selected _51sy');
for(var i=0; i<inputs_confirm.length;i++) {
if ( i == 10) { break; };
count_confirm++;
inputs_confirm[i].click();
console.log("Click Confirm " + count_confirm);
};
};
var click_ok = function () {
//button 'Okay' when a post was deleted already
var inputs_confirm = document.getElementsByClassName('_42ft _4jy0 layerCancel uiOverlayButton _4jy3 _4jy1 selected _51sy');
for(var i=0; i<inputs_confirm.length;i++) {
if ( i == 10) { break; };
inputs_confirm[i].click();
console.log("Click OK ");
};
};
var interval_del = setInterval( function () { click_del() }, 8000);
var interval_confirm = setInterval( function () { click_confirm() }, 3000);
var interval_ok = setInterval( function () { click_ok() }, 8000);
//clearInterval(interval_ok);
//automatically scroll down to the bottom of page - ref: http://bit.ly/1O4tvHd
var interval_bottom_page = setInterval( function () { window.scrollTo(0,document.body.scrollHeight) }, 30000); ;
@marcos635
Copy link

@jacksparrow5 The same thing as the htdat script, but in a simpler way.

@jacksparrow5
Copy link

@marcos635 Thanks buddy will check
is there any script to delete all "facebook group posts" with "specific keyword" search?

@skphantom
Copy link

Hey Guys,
Is there someone able to customize this script and allow blocking member while deleting the pending post?
Cheers

@volkankaban
Copy link

Abandoned.

@htdat
Copy link
Author

htdat commented Apr 26, 2021

Hi all, I have not managed a FB group for a long time.
Feel free to discuss or write links to other solutions, however, I am not able to fix or modify my original script.

@Virneto
Copy link

Virneto commented May 4, 2021

Hi all, I have not managed a FB group for a long time.
Feel free to discuss or write links to other solutions, however, I am not able to fix or modify my original script.

Hi htdat.
For some reason I can't find exactly the class for the deletion element.
FB code is getting increasingly obfuscated.

Any code that could remove all pending live videos would be of great help.

@amitdevopsschool
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment