Included Modules

Files

Nicovideo::Newarrival

Public Class Methods

new(agent, pagenum) click to toggle source
# File lib/nicovideo/newarrival.rb, line 5
def initialize(agent, pagenum)
  super(agent)

  @pagenum = pagenum > 10 ? 10 : pagenum

  params = ["videos"]
  self.register_getter params

  @url = url()
end

Public Instance Methods

each() click to toggle source
# File lib/nicovideo/newarrival.rb, line 25
def each
  self.videos.each {|v| yield v }
end
parse(page) click to toggle source
# File lib/nicovideo/newarrival.rb, line 16
def parse(page)
  result_xpath = page/'//div[@class="cmn_thumb_R"]//p[@class="TXT12"]/a[@class="video"]'
  @videos = result_xpath.inject([]) do |arr, v|
    vp = VideoPage.new(@agent, v.attributes['href'].sub(/watch\/(\w+)$/,'\1'))
    vp.title = v.inner_html
    arr << vp
  end
end
url() click to toggle source
# File lib/nicovideo/newarrival.rb, line 29
def url
  opt = '?page=' + @pagenum.to_s if @pagenum
  "#{BASE_URL}/newarrival#{opt}"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.