Parent

Included Modules

Files

Nicovideo::Random

Public Class Methods

new(agent) click to toggle source
# File lib/nicovideo/random.rb, line 5
def initialize agent
  super(agent)
  @url = url()
  self.register_getter ["videos"]
end

Public Instance Methods

each() click to toggle source
# File lib/nicovideo/random.rb, line 11
def each
  self.videos.each {|v| yield v }
end
reload() click to toggle source
# File lib/nicovideo/random.rb, line 23
def reload
end
to_a() click to toggle source
# File lib/nicovideo/random.rb, line 19
def to_a
  videos()
end
url() click to toggle source
# File lib/nicovideo/random.rb, line 15
def url
  "#{BASE_URL}/random"
end

Protected Instance Methods

parse(page) click to toggle source
# File lib/nicovideo/random.rb, line 27
def parse(page)
  result_xpath = page/'//td[@class="random_td"]//p[@class="TXT12"]/a[@class="video"]'
  @videos = result_xpath.inject([]) {|arr,v| #
    #puts v.attributes['href']
    vp = VideoPage.new(@agent, v.attributes['href'].sub(/watch\/(\w+)$/,'\1'))
    vp.title = v.inner_html
    arr << vp
  }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.