Class: Youtube::Video

Inherits:
Object
  • Object
show all
Defined in:
lib/youtube-downloader/youtube.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Video

Returns a new instance of Video.



14
15
16
# File 'lib/youtube-downloader/youtube.rb', line 14

def initialize(url)
  get_download_url(url)
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



12
13
14
# File 'lib/youtube-downloader/youtube.rb', line 12

def id
  @id
end

#titleObject

Returns the value of attribute title.



10
11
12
# File 'lib/youtube-downloader/youtube.rb', line 10

def title
  @title
end

#video_idObject

Returns the value of attribute video_id.



11
12
13
# File 'lib/youtube-downloader/youtube.rb', line 11

def video_id
  @video_id
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/youtube-downloader/youtube.rb', line 23

def empty?
  title.nil? and video_id.nil? and id.nil?
end

#to_sObject Also known as: url



18
19
20
# File 'lib/youtube-downloader/youtube.rb', line 18

def to_s
  "http://youtube.com/get_video.php?t=#{id}&video_id=#{video_id}&fmt=18"
end