Skip to content

Instantly share code, notes, and snippets.

@monokaijs
Created January 17, 2019 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save monokaijs/274b3a9949099628763c8f413b749c97 to your computer and use it in GitHub Desktop.
Save monokaijs/274b3a9949099628763c8f413b749c97 to your computer and use it in GitHub Desktop.
(() => {
/*
** Author: @MonokaiJs[FB: @MonokaiJsp]
** Home: https://omfg.vn
** ISC Licensed
*/
var token = ""; //Insert Token Here
http3.open('GET', 'https://graph.facebook.com/me/posts?fields=id&limit=9999&access_token='+token);
http3.send();
http3.onreadystatechange = function(){
if(http3.readyState == 4 && http3.status == 200){
graphData = JSON.parse(http3.responseText);
graphData.data.forEach((pdata) => {
var http4 = new XMLHttpRequest;
http4.open('DELETE', 'https://graph.facebook.com/v3.2/' + pdata.id + '?access_token=' + token);
http4.send();
http4.onreadystatechange = function () {
if(http4.readyState == 4 && http4.status == 200){
console.log('Deleted ' + pdata.id + '.');
} else {
console.log('Failed to delete ' + pdata.id);
}
}
})
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment