Class: Youtube::Downloader

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

Instance Method Summary collapse

Constructor Details

#initialize(video) ⇒ Downloader

Returns a new instance of Downloader.



3
4
5
# File 'lib/youtube-ripper/downloader.rb', line 3

def initialize(video)
  @video = video
end

Instance Method Details

#filenameObject



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

def filename
  @filename ||= @video.title.strip.downcase.gsub(/[^a-z0-9]+/, '_') + ".mp4"
end

#perform!Object



7
8
9
# File 'lib/youtube-ripper/downloader.rb', line 7

def perform!
  `curl "#{@video.url}" -L -o #{filename}`
end