Created
January 21, 2025 23:17
-
-
Save effariwhy/5f4efe3041f8d7fc5f412cdef6427621 to your computer and use it in GitHub Desktop.
Delete all reels from your facebook account
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
// Here is a script that will automatically click on buttons | |
// to delete all your reels one by one from your Facebook account. | |
// | |
// * Log into facebook using chrome | |
// * Navigate to the Reels area (or go to https://www.facebook.com/REPLACE_THIS_WITH_YOUR_USERNAME/reels_tab) | |
// * Press F12 on your keyboard to open the developer tools | |
// * Find the console in the developer tools and scroll to the bottom to the command prompt (last line at the bottom) | |
// * View your most recent reel (this code starts with the most recent and deletes until it gets to the oldest) | |
// * Copy and paste all of this code into the command prompt and press enter | |
// | |
// It will take approximately 7 seconds to delete a reel. Do not leave the page in your browser or the process will stop. | |
// If the process fails and stops, just reload the page copy/paste + run the code again. | |
// | |
// This script was adapted from https://gist.github.com/bohwaz/afcbc9c7dbca169c60cf7ed9f69ea507 | |
// If you are using facebook in a language other than English, you will need to update the label | |
// variables below | |
var reel_menu_label = "Menu"; | |
var reel_delete_label = "Delete"; | |
var reel_confirm_delete_label = "Delete"; | |
while(true) { | |
var menu = document.querySelector('div[role="main"] div[aria-label="' + reel_menu_label + '"]'); | |
if (!menu) { | |
alert('No reel found'); | |
break; | |
} | |
menu.click(); | |
await new Promise(r => setTimeout(r, 1000)); | |
var buttons = document.evaluate("//span[contains(., '" + reel_delete_label + "')]", document, null, XPathResult.ANY_TYPE, null ); | |
var button = buttons.iterateNext(); | |
button.click(); | |
await new Promise(r => setTimeout(r, 2000)); | |
document.querySelectorAll('[aria-label="' + reel_confirm_delete_label + '"]')[0].click(); | |
await new Promise(r => setTimeout(r, 4000)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment