Created
July 18, 2022 21:19
-
-
Save jaredatron/bcc6b18ba808abd231dfa63b9bcefda2 to your computer and use it in GitHub Desktop.
add all photos to an google photos album
This file contains 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
// 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