Class: ESearchy::SearchEngines::Altavista

Inherits:
GenericEngine show all
Defined in:
lib/esearchy/SearchEngines/altavista.rb

Constant Summary collapse

ENGINE =
"www.altavista.com"
PORT =
80
NUM =
100
TYPE =
1

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

#parse(html) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/esearchy/SearchEngines/altavista.rb', line 14

def parse( html )
  hits = html.scan(/AltaVista found (.*) results<\/A>/) 
  if hits.empty? or hits == nil
    @totalhits = 0
  else
    @totalhits = totalhits(hits[0][0].gsub(',','').to_i)
  end
  super html.scan(/<a class='res' href='([a-zA-Z0-9:\/\/.&?%=\-_+]*)'>/)
end

#searchObject



9
10
11
12
# File 'lib/esearchy/SearchEngines/altavista.rb', line 9

def search 
  @querypath = "/web/results?itag=ody&kgs=0&kls=0&nbq=50&q=" + @query + "&stq="
  super
end