module YoutubeDL

Global YoutubeDL module. Contains some convenience methods and all of the business classes.

Version file If you are updating this code, make sure you are updating lib/youtube-dl/version.rb as well as the Rakefile.

Constants

VERSION

Semantic Version as well as the bundled binary version. “(major).(minor).(teeny).(pre-release).(binary-version)”

Public Instance Methods

binary_version() click to toggle source

Returns youtube-dl's version

@return [String] youtube-dl version

# File lib/youtube-dl.rb, line 41
def binary_version
  @binary_version ||= cocaine_line('--version').run.strip
end
download(urls, options = {}) click to toggle source

Downloads given array of URLs with any options passed

@param urls [String, Array] URLs to download @param options [Hash] Downloader options @return [YoutubeDL::Video, Array] Video model or array of Video models

# File lib/youtube-dl.rb, line 21
def download(urls, options = {})
  if urls.is_a? Array
    urls.map { |url| YoutubeDL::Video.get(url, options) }
  else
    YoutubeDL::Video.get(urls, options) # Urls should be singular but oh well. url = urls. There. Go cry in a corner.
  end
end
Also aliased as: get
extractors() click to toggle source

Lists extractors

@return [Array] list of extractors

# File lib/youtube-dl.rb, line 34
def extractors
  @extractors ||= cocaine_line('--list-extractors').run.split("\n")
end
get(urls, options = {})
Alias for: download
user_agent() click to toggle source

Returns user agent

@return [String] user agent

# File lib/youtube-dl.rb, line 48
def user_agent
  @user_agent ||= cocaine_line('--dump-user-agent').run.strip
end