class Tinderbot::Facebook

Constants

FACEBOOK_AUTHENTICATION_TOKEN_URL

Public Class Methods

get_credentials(facebook_email, facebook_password) click to toggle source
# File lib/tinderbot/facebook.rb, line 5
def self.get_credentials(facebook_email, facebook_password)
  browser = Watir::Browser.new
  browser.goto FACEBOOK_AUTHENTICATION_TOKEN_URL
  browser.text_field(id: 'email').when_present.set facebook_email
  browser.text_field(id: 'pass').when_present.set facebook_password
  browser.button(name: 'login').when_present.click

  facebook_authentication_token = /#access_token=(.*)&expires_in/.match(browser.url).captures[0]

  browser.goto 'https://www.facebook.com/'
  browser.link(class: 'fbxWelcomeBoxName').when_present.click
  facebook_user_id = /fbid=(.*)&set/.match(browser.link(class: 'profilePicThumb').when_present.href).captures[0]

  browser.close
  return facebook_authentication_token, facebook_user_id
end