Skip to content

Instantly share code, notes, and snippets.

@jaredatron
Created July 18, 2022 21:19
Show Gist options
  • Save jaredatron/bcc6b18ba808abd231dfa63b9bcefda2 to your computer and use it in GitHub Desktop.
Save jaredatron/bcc6b18ba808abd231dfa63b9bcefda2 to your computer and use it in GitHub Desktop.
add all photos to an google photos album
// make new album and go to the add images page then run this script in the console
stopIt = false
;(async () => {
const scrollParent = $('.Purf9b')
const wait = async ms => {
await new Promise((r, rj) => {
setTimeout(() => { r() }, ms)
})
}
const pageDown = async () => {
console.log('scrollParent.scrollTop', scrollParent.scrollTop)
scrollParent.scrollTop += scrollParent.offsetHeight
await wait(1000)
console.log('scrollParent.scrollTop', scrollParent.scrollTop)
}
const clickem = async () => {
if (stopIt) return
const targets = [...$$('.R4HkWb[aria-checked="false"]')];
console.log('targets.length', targets.length)
for (const t of targets){
console.log('clicking', t)
t.scrollIntoView();
t.click();
await wait(2000)
}
await pageDown()
return clickem()
}
clickem()
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment