Class: YoutubeDlRuby::Ydlr

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

Overview

Your code goes hereā€¦

Instance Method Summary collapse

Instance Method Details

#download(url) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/youtube_dl_ruby.rb', line 9

def download(url)
	params = CGI::parse(URI.parse(url).query)

	throw VideoUrlHasNoVideoId if not params.has_key?('v')

	system("youtube-dl -o './public/downloaded/%(title)s.%(ext)s' --extract-audio --audio-format mp3 --audio-quality 128K http://www.youtube.com/watch?v=#{params['v'][0]}")
end