Created
October 1, 2012 12:55
-
-
Save danpariente/3811650 to your computer and use it in GitHub Desktop.
Facebook Search Crawler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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