Class: Garlenko::Yahoo

Inherits:
Base
  • Object
show all
Includes:
Crawler
Defined in:
lib/garlenko/yahoo.rb

Constant Summary collapse

LOGIN_URL =
"https://login.yahoo.com/config/login_verify2"
CONTACTS_URL =
"http://address.mail.yahoo.com/?.rand=930244936"
CONTACTS_LIST_URL =
"http://address.mail.yahoo.com/?_src=&_crumb=crumb&sortfield=3&bucket=1&scroll=1&VPC=social_list&.r=time"

Instance Attribute Summary

Attributes inherited from Base

#password, #username

Instance Method Summary collapse

Methods included from Crawler

#agent

Methods inherited from Base

#connected?, #initialize

Constructor Details

This class inherits a constructor from Garlenko::Base

Instance Method Details

#connect!Object



13
14
15
16
17
18
19
20
# File 'lib/garlenko/yahoo.rb', line 13

def connect!
   = agent.get(LOGIN_URL).form("login_form")
  . = @username
  .passwd = @password
   = agent.submit(, .submits.first)
  address_page = agent.get(CONTACTS_URL)
  @connected = address_page.body.include?("masthead_welcome2")
end

#contactsObject



22
23
24
25
26
27
28
# File 'lib/garlenko/yahoo.rb', line 22

def contacts
  return @contacts if @contacts
  connect! unless connected?
  @contacts = []
  @contacts = fetch_page(1, crumb_from(agent.get(CONTACTS_URL).body))
  @contacts
end