Skip to content

Instantly share code, notes, and snippets.

@technoplato
Created October 17, 2019 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save technoplato/47f63d15e2aa29693f713fcb3f08b2c0 to your computer and use it in GitHub Desktop.
Save technoplato/47f63d15e2aa29693f713fcb3f08b2c0 to your computer and use it in GitHub Desktop.
YouTube Upload - AppleScript - Brute Force
activate application "Safari Technology Preview"
tell application "Safari Technology Preview"
tell document 1
set the URL to "https://youtube.com/upload"
delay 2
do JavaScript "document.getElementById('start-upload-button-single').click()"
end tell
end tell
tell application "System Events"
keystroke "G" using {command down, shift down}
delay 1
keystroke "~/Desktop/videos/"
delay 1
keystroke return
delay 1
key code 124
delay 1
keystroke "a" using {command down}
delay 1
keystroke return
tell application "Safari Technology Preview"
tell document 1
delay 2
do JavaScript "document.getElementById('bulk-privacy-selector').click()"
delay 2
do JavaScript "document.getElementsByClassName('bulk-set-privacy-unlisted')[0].click()"
delay 2
do JavaScript "document.getElementsByClassName('expand-button-text).forEach(d => d.click())"
delay 2
do JavaScript "[...document.getElementsByClassName('upload-item')].map(uploadItem => {
uploadItem.getElementsByClassName('expand-button-text')[0].click()
const titleNodes = uploadItem.getElementsByClassName('video-settings-title')[0].value
console.log(titleNodes)
const nodes = uploadItem.querySelector('.watch-page-link, a').childNodes
if (nodes.length > 1) {
console.log(nodes[1].text)
}
})"
end tell
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment