2011-06-07 05:18:22 +04:00
|
|
|
# Upload an image to imagebin.org
|
|
|
|
|
2011-09-13 00:17:54 +04:00
|
|
|
page = require('webpage').create()
|
2012-01-14 19:13:26 +04:00
|
|
|
system = require 'system'
|
2011-06-07 05:18:22 +04:00
|
|
|
|
2012-01-14 19:13:26 +04:00
|
|
|
if system.args.length isnt 2
|
2011-06-07 05:18:22 +04:00
|
|
|
console.log 'Usage: imagebin.coffee filename'
|
2012-05-16 11:37:26 +04:00
|
|
|
phantom.exit 1
|
2011-06-07 05:18:22 +04:00
|
|
|
else
|
2012-01-14 19:13:26 +04:00
|
|
|
fname = system.args[1]
|
2011-06-07 05:18:22 +04:00
|
|
|
page.open 'http://imagebin.org/index.php?page=add', ->
|
|
|
|
page.uploadFile 'input[name=image]', fname
|
|
|
|
page.evaluate ->
|
|
|
|
document.querySelector('input[name=nickname]').value = 'phantom'
|
|
|
|
document.querySelector('input[name=disclaimer_agree]').click()
|
|
|
|
document.querySelector('form').submit()
|
|
|
|
|
|
|
|
window.setTimeout ->
|
|
|
|
phantom.exit()
|
|
|
|
, 3000
|