-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Selects images, doesn't seem to delete them #32
Comments
I experience the same on both Edge as Chrome. Console does prints it is deleting but it seems the actual delete does not happen This branch contains the necessary fixes (not my work): https://raw.githubusercontent.com/gutschik/google-photos-delete-tool/master/delete_photos.js |
Just seen this update, tried out the updated code works fine on Chrome 89.0.4389.82, thanks for fixing, hope this code will be promoted for other users |
Same issue here. But used the above modified script and it runs wonderfully!!!!! Thanks!! |
Looks like you need to update the |
This solution works perfectly. Thanks! |
Great script! Unfortunately, I also ran into issues with delete not working. I made a few changes to help me delete over 40K photos.
I'm posting my changes below. Modified Code// How many photos to delete?
// Put a number value, like this
// const maxImageCount = 5896
const maxImageCount = "ALL_PHOTOS";
// Selector for Images and buttons
const ELEMENT_SELECTORS = {
checkboxClass: '.ckGgle',
deleteButton: 'button[aria-label="Delete"]',
confirmationButton: '#yDmH0d > div.llhEMd.iWO5td > div > div.g3VIld.V639qd.bvQPzd.oEOLpc.Up8vH.J9Nfi.A9Uzve.iWO5td > div.XfpsVe.J9fJmf > button.VfPpkd-LgbsSe.VfPpkd-LgbsSe-OWXEXe-k8QpJ.nCP5yc.kHssdc.HvOprf'
}
// Time Configuration (in milliseconds)
const TIME_CONFIG = {
delete_cycle: 12000,
press_button_delay: 8000
};
const MAX_RETRIES = 10;
let imageCount = 0;
let checkboxes;
let buttons = {
deleteButton: null,
confirmationButton: null
}
let deleteTask = () => {
let attemptCount = 1;
do {
checkboxes = document.querySelectorAll(ELEMENT_SELECTORS['checkboxClass']);
} while (checkboxes.length <= 0 && attemptCount++ < MAX_RETRIES);
if (checkboxes.length <= 0) {
console.log("[INFO] No more images to delete.");
clearInterval(deleteTask);
console.log("[SUCCESS] Tool exited.");
return;
}
imageCount += checkboxes.length;
checkboxes.forEach((checkbox) => { checkbox.click() });
setTimeout(() => {
console.log("[INFO] Deleting", checkboxes.length, "images");
buttons.deleteButton = document.querySelector(ELEMENT_SELECTORS['deleteButton']);
buttons.deleteButton.click();
setTimeout(() => {
buttons.confirmation_button = document.querySelector(ELEMENT_SELECTORS['confirmationButton']);
buttons.confirmation_button.click();
console.log(`[INFO] ${imageCount}/${maxImageCount} Deleted`);
if (maxImageCount !== "ALL_PHOTOS" && imageCount >= parseInt(maxImageCount)) {
console.log(`${imageCount} photos deleted as requested`);
console.log("[SUCCESS] Tool exited.");
return;
} else { setTimeout(deleteTask, TIME_CONFIG.delete_cycle) }
}, TIME_CONFIG.press_button_delay)
}, TIME_CONFIG.press_button_delay)
};deleteTask(); |
Thanks Sandro, it works |
Thanks Sandro! works like a charm! |
The language needs to be English otherwise it will not find the "delete" button |
I increased the timeouts by a factor of 2X. I see the photos selected, but I don't see the delete actions occur.
Rather it seems to repeatedly: Select the same images, clear upon deleation, and select those images again.
I checked and my language was set to US English. I set to English and the behavior was the same.
Maybe a side effect of using Chromium vs. Chrome?
Version 89.0.4389.82 (Official Build) Arch Linux (64-bit)
The text was updated successfully, but these errors were encountered: