Class: Nicovideo::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/nicovideo/page.rb

Direct Known Subclasses

MyList, Newarrival, OpenList, Random, Ranking, Search, VideoPage

Constant Summary collapse

NV_DEBUG_LEVEL =
0
BASE_URL =
'http://www.nicovideo.jp'
BASE_TITLE1 =
'‐ニコニコ動画\(.*?\)'.toutf8
BASE_TITLE2 =
'ニコニコ動画\(.*?\)‐'.toutf8

Instance Method Summary collapse

Constructor Details

#initialize(agent) ⇒ Page

Returns a new instance of Page.



12
13
14
15
16
17
18
# File 'lib/nicovideo/page.rb', line 12

def initialize agent
  @agent = agent
  @page  = nil
  @title = nil

  @not_found = false
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
# File 'lib/nicovideo/page.rb', line 21

def exists?()
  begin
    @page = @page || get_page
    return true
  rescue
    return false
  end
end

#htmlObject



30
31
32
33
34
# File 'lib/nicovideo/page.rb', line 30

def html()
  page = @page || get_page
  return nil unless page
  page.parser.to_html
end

#title=(title) ⇒ Object



36
37
38
# File 'lib/nicovideo/page.rb', line 36

def title=(title)
  @title = title
end