-
Notifications
You must be signed in to change notification settings - Fork 95
How to do the do (Usage)
Justin Roberson edited this page Sep 8, 2015
·
2 revisions
Pretty simple.
YoutubeDL.download "https://www.youtube.com/watch?v=gvdf5n-zI14", output: 'some_file.mp4'
All options available to youtube-dl can be passed to the options hash
options = {
username: 'someone',
password: 'password1',
rate_limit: '50K',
format: :worst # Make sure you are on the latest Cocaine version for this to work (see https://github.com/thoughtbot/cocaine/pull/78)
}
YoutubeDL.download "https://www.youtube.com/watch?v=gvdf5n-zI14", options
Want to get fancy? Initialize your own YoutubeDL::Video
instance.
video = YoutubeDL::Video.new(https://www.youtube.com/watch?v=m1pchpDD5EU)
video.options.configure do |c|
c.get_filename = true
c.output = "%(title)s.mp3"
c.simulate = true
c.extract_audio = true
c.audio_format = 'mp3'
end
video.download
video.filename # => 'The Chipophone.mp3'