Class: ESearchy::SearchEngines::Yahoo
- Inherits:
-
GenericEngine
- Object
- GenericEngine
- ESearchy::SearchEngines::Yahoo
- Defined in:
- lib/esearchy/SearchEngines/yahoo.rb
Constant Summary collapse
- ENGINE =
"boss.yahooapis.com"
- PORT =
80
- NUM =
50
- 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
#appid=(value) ⇒ Object
16 17 18 |
# File 'lib/esearchy/SearchEngines/yahoo.rb', line 16 def appid=(value) @appid = value end |
#parse(json) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/esearchy/SearchEngines/yahoo.rb', line 20 def parse(json) doc = JSON.parse(json) hits = doc["ysearchresponse"]["totalhits"].to_i if hits == nil or hits == 0 @totalhits = 0 else @totalhits = totalhits(hits) end super doc["ysearchresponse"]["resultset_web"] end |
#search ⇒ Object
9 10 11 12 13 14 |
# File 'lib/esearchy/SearchEngines/yahoo.rb', line 9 def search @querypath = "/ysearch/web/v1/" + @query + "?appid="+ @appid + "&format=json&count=50" or raise ESearchyMissingAppID, "Missing AppID <Class.appid=>" super end |