Skip to content

Instantly share code, notes, and snippets.

@ikarino
Last active August 29, 2015 14:13
Show Gist options
  • Save ikarino/3f622287a1e23fe84150 to your computer and use it in GitHub Desktop.
Save ikarino/3f622287a1e23fe84150 to your computer and use it in GitHub Desktop.
login nico applescript
on loginFromSafari(username, password)
set loginURL to "https://secure.nicovideo.jp/secure/login_form"
tell application "Safari"
activate
make new document with properties {URL:loginURL}
delay 1
do JavaScript "document.getElementsByName('mail_tel')[0].value = '" & username & "';" in document 1
do JavaScript "document.getElementsByName('password')[0].value = '" & password & "';" in document 1
do JavaScript "document.getElementsByClassName('login_button')[0].children[0].click();" in document 1
close document 1
end tell
end loginFromSafari
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment