Created
December 30, 2023 00:56
-
-
Save JaosnHsieh/5aee429d2ce6a4e1fa10e2632ee98252 to your computer and use it in GitHub Desktop.
google photos delete all photos day by day
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
/* 2023.12.29 google photos delete all photos day by day | |
1. visit google photos | |
2. replace the buttons css selectors first by manualy right click and see current selectors | |
3. run the script on console | |
*/ | |
// List of events to trigger | |
const events = ['click']; | |
// Function to trigger event | |
function triggerEvent(element, eventName) { | |
var event = new Event(eventName, { | |
'bubbles': true, | |
'cancelable': true | |
}); | |
element.dispatchEvent(event); | |
} | |
function wait(ms = 1000) { | |
return new Promise((ok)=>{ | |
setTimeout(ok, ms); | |
}); | |
} | |
const clickDelete = () => { | |
const button = document.querySelector(`#yDmH0d > c-wiz > div.u5a4d.QtDoYb.KWdEHf.g7of6e.maPcY > div > div.c9yG5b.txMZRd > div > div:nth-child(4) > span > button`); | |
if(!button) console.error('no delete button'); | |
if (button) triggerEvent(button, 'click'); | |
}; | |
const clickConfirm = () => { | |
const button2 = document.querySelectorAll(`.VfPpkd-LgbsSe`)[4]; | |
if(!button2) console.error('no confirm button'); | |
if (button2) triggerEvent(button2, 'click'); | |
} | |
async function select() { | |
const checkboxes = document.querySelectorAll('[role="checkbox"]:not(:checked)'); | |
if (!checkboxes[0]) console.error('no checked box'); | |
if (checkboxes[0]) triggerEvent(checkboxes[0], 'click'); | |
} | |
async function run(){ | |
select(); | |
await wait(2000); | |
clickDelete(); | |
await wait(2000); | |
clickConfirm(); | |
await wait(); | |
} | |
setInterval(run,10000); | |
run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment