Class: ESearchy::SocialEngines::GooglePlus

Inherits:
GenericEngine show all
Defined in:
lib/esearchy/SocialEngines/googleplus.rb

Constant Summary collapse

ENGINE =
"www.google.com"
PORT =
80
NUM =
100
TYPE =
2

Instance Attribute Summary

Attributes inherited from GenericEngine

#documents, #emails, #people, #results

Instance Method Summary collapse

Methods inherited from GenericEngine

#company=, #initialize, #maxhits=, #start=

Constructor Details

This class inherits a constructor from ESearchy::GenericEngine

Instance Method Details

#crawl_people(text) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/esearchy/SocialEngines/googleplus.rb', line 27

def crawl_people(text)
  text.scan(/<a class="l" href="([0-9A-Za-z:\\\/?&=@+%.;"'()_-]+)" [\sonmousedown="return curwt(this, ']*[0-9A-Za-z:\\\/?&=@+%.;"'()_-]*[')"]*>([\w\s]*) -/).each do |profile|
    pf = profile[0].to_s
    pf = pf.scan(/\/url\?q=([0-9A-Za-z:\\\/?=@+%.;"'()_-]+) - Google+/).to_s if pf.match(/\/url\?q=/)
    p = profile[1].split(" ") 
    @people << [ p, pf ]
    @results << [p, "P",profile, self.class.to_s.upcase, "N"]
  end
end

#parse(html) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/esearchy/SocialEngines/googleplus.rb', line 17

def parse( html )
  #Results <b>1</b> - <b>8</b> of <b>8</b> from <b>www.google.com</b>
  hits = html.scan(/<\/b> of <b>(.*)<\/b> from /)
  if hits.empty? or hits == nil
    @totalhits = 0
  else
    @totalhits = totalhits(hits[0][0].gsub(",","").to_i) unless @was_here
  end
end

#searchObject



9
10
11
12
13
14
15
# File 'lib/esearchy/SocialEngines/googleplus.rb', line 9

def search 
  @querypath = "/cse?q=site:https://plus.google.com+intitle:%22Google+" +
               "Profile%22+%22Companies+I%27ve+worked+for%22+%22at+" +  
               CGI.escape(@company) + "%22&hl=en&cof=&num=100&filter=0&safe=off&start=" or
               raise ESearchyMissingCompany, "Mssing website url Object.company=(value)"
  super
end