Class: YoutubeAudioDownloader

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

Class Method Summary collapse

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 "    cd \#{outdir} && \\\n    youtube-dl \\\n        --extract-audio \\\n        --output \#{filename} \\\n        --audio-format \#{opts[:format]} \\\n        --audio-quality \#{opts[:quality]} \\\n        \#{\"--prefer-ffmpeg\" if opts[:prefer_ffmpeg]} \\\n      \#{url} \\\n      &>/dev/null\n  SH\nend\n"

.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 "    cd \#{outdir} && \\\n    youtube-dl \\\n        --extract-audio \\\n        --yes-playlist \\\n        --audio-format \#{opts[:format]} \\\n        --audio-quality \#{opts[:quality]} \\\n        \#{\"--prefer-ffmpeg\" if opts[:prefer_ffmpeg]} \\\n      \#{url} \\\n      &>/dev/null\n  SH\nend\n"