Security Software Armory: > Miscellaneous: Anti-Malware tools, discussions, advices...

How to remove ALL Google Photos with 1 mass selection

(1/1)

devnullius:
It's 2020. Somehow, Google thinks it's dangerous for people to remove all their photos at once. And this is a major pita if you actually want to remove all images: it just can't be done and you'll spend the day selecting a few images at a time. This will not do!

Enter, Mohammed: https://support.google.com/photos/thread/197868?hl=en&msgid=37269386

Browser Console Script to run:

--- Code: ---for(i = 1; i<=9999; i++) {
    console.log("Iteration # --> " + i);
    document.querySelectorAll('div[role=checkbox]').forEach(div=>div.click());
    document.querySelectorAll('div[aria-label*="Select all photos"]').forEach(div=>div.click());
    await new Promise(r => setTimeout(r, 3000));
try{console.log("Selected documents count for iteration [" + i + "]: " + document.evaluate('/html/body/div[1]/div/c-wiz/c-wiz[2]/span/div[1]/div/span', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerText);}catch(ex){/*do nothing*/}
    document.querySelector('button[title=Delete]').click();
    await new Promise(r => setTimeout(r, 5000));
    document.evaluate('//span[text()="Move to trash"]', document, null, XPathResult.ANY_TYPE, null ).iterateNext().click();

    //wait for new images to load
    await new Promise(r => setTimeout(r, 10000));
}
--- End code ---

devnullius:

--- Code: ---for(i = 1; i<=9999; i++) {
    console.log("Iteration # --> " + i);
    document.querySelectorAll('div[role=checkbox]').forEach(div=>div.click());
    document.querySelectorAll('div[aria-label*="Select all photos"]').forEach(div=>div.click());
    await new Promise(r => setTimeout(r, 3000));
try{console.log("Selected documents count for iteration [" + i + "]: " + document.evaluate('/html/body/div[1]/div/c-wiz/c-wiz[2]/span/div[1]/div/span', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerText);}catch(ex){/*do nothing*/}
    document.querySelector('button[title=Delete]').click();
    await new Promise(r => setTimeout(r, 5000));
    document.evaluate('//span[text()="Move to trash"]', document, null, XPathResult.ANY_TYPE, null ).iterateNext().click();

    //wait for new images to load
    await new Promise(r => setTimeout(r, 10000));
}
--- End code ---

If the script throws above error, it means not all thumbnails are fully loaded. They need to be visible for the script to be able to detect them. Make your window a bit smaller or zoom in a bit instead of max zoom out.

Betty Larson:
The coding updates here are quite provoking to all. I hope that after the updates the various people are able to learn about and know how to fix and remove bugs.  Keep going with review resumeble work here please continue sharing.

Navigation

[0] Message Index

Reply

Go to full version