Class: YoutubeAudioDownloader
- Inherits:
-
Object
- Object
- YoutubeAudioDownloader
- Defined in:
- lib/version.rb,
lib/youtube_audio_downloader.rb
Constant Summary collapse
- VERSION =
'1.0.1'
Class Method Summary collapse
- .download_audio(url, outdir, filename, opts = {}) ⇒ Object
- .download_playlist(url, outdir, opts = {}) ⇒ Object
Class Method Details
.download_audio(url, outdir, filename, opts = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/youtube_audio_downloader.rb', line 5 def self.download_audio(url, outdir, filename, opts={}) opts = set_default_opts(opts) system <<-SH cd #{outdir} && \ youtube-dl \ --extract-audio \ --output #{filename} \ --audio-format #{opts[:format]} \ --audio-quality #{opts[:quality]} \ #{"--prefer-ffmpeg" if opts[:prefer_ffmpeg]} \ #{url} \ &>/dev/null SH end |
.download_playlist(url, outdir, opts = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/youtube_audio_downloader.rb', line 20 def self.download_playlist(url, outdir, opts={}) opts = set_default_opts(opts) system <<-SH cd #{outdir} && \ youtube-dl \ --extract-audio \ --yes-playlist \ --audio-format #{opts[:format]} \ --audio-quality #{opts[:quality]} \ #{"--prefer-ffmpeg" if opts[:prefer_ffmpeg]} \ #{url} \ &>/dev/null SH end |