Skip to content

Instantly share code, notes, and snippets.

@youpy
Created May 25, 2011 06:55
Show Gist options
  • Save youpy/990479 to your computer and use it in GitHub Desktop.
Save youpy/990479 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'ubygems'
require 'grope'
def make_shindan(result)
env = Grope::Env.new
env.load('http://shindanmaker.com/c/make')
env.wait
doc = env.document
doc.getElementById('pd[posttitle]').value = result + ([0x200e].pack('U') * rand(20))
doc.getElementById('pd[postdesc]').value = result
doc.getElementById('pd[postresult]').value = '[RESULT1]'
env.find('//textarea[@name="pd[postlist1]"]').value = result
env.capture(env.find('//img[starts-with(@src, "/c/image")]'), '/tmp/xxx.png')
`open /tmp/xxx.png`
print "captcha: "
captcha = STDIN.gets.chomp
env.find('//input[@name="image_key"]').value = captcha
env.find('//input[@type="submit"]').click
env.wait(10)
env.all('//input[@type="submit"]')[1].click
env.wait
env.document.body.innerHTML.match(/http:\/\/shindanmaker\.com\/\d+/)[0]
end
def tweet(id, password, status)
env = Grope::Env.new
env.load('http://twitter.com/intent/tweet?text=' + CGI.escape(status))
env.wait
doc = env.document
doc.getElementById('username_or_email').value = id
doc.getElementById('password').value = password
doc.getElementById('login-form').submit
env.wait(5)
env.document.getElementById('update-form').submit
env.wait
end
def main
status, id, password = ARGV
tweet(id, password, [status, make_shindan(status)].join(' '))
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment