Skip to content

Instantly share code, notes, and snippets.

@danpariente
Created October 1, 2012 12:55
Show Gist options
  • Save danpariente/3811650 to your computer and use it in GitHub Desktop.
Save danpariente/3811650 to your computer and use it in GitHub Desktop.
Facebook Search Crawler
require 'mechanize'
agent = Mechanize.new
page = agent.get('https://m.facebook.com/')
login_form = page.forms.first
login_form.email = "user@mail.com"
login_form.pass = "password"
main_page = agent.submit(login_form, login_form.buttons.first)
search_form = main_page.forms.last
query = "Lindsay Lohan"
search_form.query = query
queries_page = agent.submit(search_form, search_form.buttons.first)
profile = queries_page.link_with(text: query).click
puts profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment