Class: Nicos::Searcher::ByTagHtml

Inherits:
ByTagSuper show all
Defined in:
lib/classes/searcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Connector::SetWait

#setWait

Methods inherited from Connector::Config

setWait, setWaitDefault

Constructor Details

#initializeByTagHtml

Returns a new instance of ByTagHtml.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/classes/searcher.rb', line 95

def initialize
  @numOfSearched = 32
  @incrAmt = 0.2

  @connector = Nicos::Connector.new(:mech)

  # HTML中の各パラメータの所在を示すXPath
  @videoIdXP  = "//div[@class='uad_thumbfrm']/table/tr/td/p/a"
  @lengthXP   = "//div[@class='uad_thumbfrm']/table/tr/td/p[2]/span"
  @viewXP     = "//div[@class='uad_thumbfrm']/table/tr/td[2]/div/nobr[1]/strong"
  @resXP      = "//div[@class='uad_thumbfrm']/table/tr/td[2]/div/nobr[2]/strong"
  @mylistXP   = "//div[@class='uad_thumbfrm']/table/tr/td[2]/div/nobr[3]/a/strong"
  @adXP       = "//div[@class='uad_thumbfrm']/table/tr/td[2]/div/nobr[4]/a/strong"
  @waitConfig = @@waitConfig
end

Instance Attribute Details

#waitConfigObject

Returns the value of attribute waitConfig.



110
111
112
# File 'lib/classes/searcher.rb', line 110

def waitConfig
  @waitConfig
end

Instance Method Details

#execute(tag, sortMethod, &block) ⇒ Object

Parameters:

  • tag (String)
  • sortMethod (String)
  • waitConfig (HashObj)


144
145
146
147
148
# File 'lib/classes/searcher.rb', line 144

def execute(tag, sortMethod, &block)
  loop(tag, sort, :mech) { |result, page|
    block.call(result, page)
  }
end