Skip to content

Instantly share code, notes, and snippets.

@pocesar
Last active October 22, 2021 11:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pocesar/3af3d73479c8f67a234f30e40ffcd41e to your computer and use it in GitHub Desktop.
Save pocesar/3af3d73479c8f67a234f30e40ffcd41e to your computer and use it in GitHub Desktop.
Facebook Javascript delete all photos
(async function walk() {
const waiter = (time) => (new Promise((resolve, reject) => {
setTimeout(resolve, time)
}))
const photo = document.querySelector('._3-8h._50zy._50-0._50z_._5upp._42ft')
const okBtn = '.uiOverlayFooter ._4jy0._4jy3._4jy1._51sy.selected._42ft'
if (photo) {
photo.click()
let l = 1
while (true) {
await waiter(1000 * l++)
let k = document.querySelector(okBtn)
if (k) {
k.click()
while (document.querySelector(okBtn)) {
await waiter(100)
}
break
}
}
} else {
return alert('done?');
}
setTimeout(walk, 1000);
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment