Created
August 7, 2017 08:30
-
-
Save mntmn/acfb78c88593cca5a2ae89139bb1113f to your computer and use it in GitHub Desktop.
Hacky script for bulk deleting FB timeline activities (posts)
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
// use on the page https://www.facebook.com/YOUR_USER_NAME/allactivity?privacy_source=activity_log&log_filter=cluster_11 | |
// scroll down to as many posts you want to delete (make pencil icons visible) | |
// recommended to delete small batches as the process gets really slow for many deletes in parallel (UI issues) | |
// we do stuff in parallel because a single delete can take up to 7 seconds | |
// to launch, call deletePost() | |
var knownPencils={}; | |
function deletePost() { | |
var pencils=document.querySelectorAll('[data-testid="pencil_icon_link"]'); | |
var pencilFound=false; | |
for (var j=0; j<pencils.length && !pencilFound; j++) { | |
var pencil=pencils[j]; | |
if (!knownPencils[pencil.id]) { | |
knownPencils[pencil.id]=true; | |
pencil.click(); | |
pencilFound=true; | |
var delbtns=document.querySelectorAll('[ajaxify^="/ajax/timeline/delete"]'); | |
for (var i=0; i<delbtns.length; i++) { | |
var btn=delbtns[i]; | |
if (btn.offsetParent!=null) { | |
console.log("delete button:",btn); | |
btn.click(); | |
setTimeout(function() { | |
var confirmBtns=document.querySelectorAll('.uiOverlayButton.layerConfirm'); | |
var confirmBtn=confirmBtns[confirmBtns.length-1]; | |
console.log("confirm button:",confirmBtn); | |
confirmBtn.click(); | |
setTimeout(deletePost, 100); | |
},500); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mntmn Cool, could it be modified to delete from the activity log as well?