Module: YoutubeDL
- Included in:
- YoutubeDL
- Defined in:
- lib/youtube-dl.rb,
lib/youtube-dl/video.rb,
lib/youtube-dl/output.rb,
lib/youtube-dl/runner.rb,
lib/youtube-dl/options.rb,
lib/youtube-dl/support.rb,
lib/youtube-dl/version.rb
Overview
Global YoutubeDL module. Contains some convenience methods and all of the business classes.
Defined Under Namespace
Modules: Support Classes: Options, Output, Runner, Video
Constant Summary collapse
- VERSION =
"0.2.1"
Instance Method Summary collapse
-
#binary_version ⇒ String
Returns youtube-dl’s version.
-
#download(urls, options = {}) ⇒ Object
(also: #get)
Downloads given array of URLs with any options passed.
-
#extractors ⇒ Array
Lists extractors.
-
#user_agent ⇒ String
Returns user agent.
Methods included from Support
cocaine_line, quoted, usable_executable_path_for, which
Instance Method Details
#binary_version ⇒ String
Returns youtube-dl’s version
39 40 41 |
# File 'lib/youtube-dl.rb', line 39 def binary_version @binary_version ||= cocaine_line('--version').run.strip end |
#download(urls, options = {}) ⇒ Object Also known as: get
Downloads given array of URLs with any options passed
19 20 21 22 23 24 25 |
# File 'lib/youtube-dl.rb', line 19 def download(urls, ={}) if urls.is_a? Array urls.map { |url| YoutubeDL::Video.get(url, ) } else YoutubeDL::Video.get(urls, ) # Urls should be singular but oh well. url = urls. There. Go cry in a corner. end end |
#extractors ⇒ Array
Lists extractors
32 33 34 |
# File 'lib/youtube-dl.rb', line 32 def extractors @extractors ||= cocaine_line('--list-extractors').run.split("\n") end |
#user_agent ⇒ String
Returns user agent
46 47 48 |
# File 'lib/youtube-dl.rb', line 46 def user_agent @user_agent ||= cocaine_line('--dump-user-agent').run.strip end |