Module: YoutubeDL

Extended by:
YoutubeDL, Support
Included in:
YoutubeDL
Defined in:
lib/youtube-dl.rb,
lib/youtube-dl/video.rb,
lib/youtube-dl/runner.rb,
lib/youtube-dl/options.rb,
lib/youtube-dl/support.rb,
lib/youtube-dl/version.rb

Overview

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

Defined Under Namespace

Modules: Support Classes: Options, Runner, Video

Constant Summary collapse

VERSION =

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

'0.3.1.2016.09.11.1'.freeze

Instance Method Summary collapse

Methods included from Support

cocaine_line, quoted, usable_executable_path_for, which

Instance Method Details

#binary_versionString

Returns youtube-dl’s version

Returns:

  • (String)

    youtube-dl version



41
42
43
# File 'lib/youtube-dl.rb', line 41

def binary_version
  @binary_version ||= cocaine_line('--version').run.strip
end

#download(urls, options = {}) ⇒ YoutubeDL::Video, Array Also known as: get

Downloads given array of URLs with any options passed

Parameters:

  • urls (String, Array)

    URLs to download

  • options (Hash) (defaults to: {})

    Downloader options

Returns:



21
22
23
24
25
26
27
# 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

#extractorsArray

Lists extractors

Returns:

  • (Array)

    list of extractors



34
35
36
# File 'lib/youtube-dl.rb', line 34

def extractors
  @extractors ||= cocaine_line('--list-extractors').run.split("\n")
end

#user_agentString

Returns user agent

Returns:

  • (String)

    user agent



48
49
50
# File 'lib/youtube-dl.rb', line 48

def user_agent
  @user_agent ||= cocaine_line('--dump-user-agent').run.strip
end