Skip to content

Instantly share code, notes, and snippets.

@youpy
Created January 1, 2012 10:40
Show Gist options
  • Save youpy/1546966 to your computer and use it in GitHub Desktop.
Save youpy/1546966 to your computer and use it in GitHub Desktop.
# OSX only
%w/ubygems grope pit/.each {|g| require g }
def main
url = 'https://www.facebook.com/'
env = Grope::Env.new
env.load(url)
if env.document.title !~ /^Facebook/
config = Pit.get("facebook.com", :require => {
'username' => 'your username in facebook',
'password' => 'your password in facebook'
})
doc = env.document
doc.getElementById('email').value = config['username']
doc.getElementById('pass').value = config['password']
doc.getElementById('login_form').submit
env.wait(1)
end
loop do
env.load('https://www.facebook.com/pokes?notif_t=poke')
js = env.eval('return Grope')
env.document.querySelectorAll('a.uiIconText').each do |item|
if item.getAttribute('ajaxify') =~ /\/ajax\/pokes\/poke_inline\.php/
js.click(item)
end
end
env.wait(3)
sleep 10
end
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment