Module: YtDlp

Extended by:
YtDlp, Support
Included in:
YtDlp
Defined in:
lib/yt-dlp.rb,
lib/yt-dlp/video.rb,
lib/yt-dlp/runner.rb,
lib/yt-dlp/options.rb,
lib/yt-dlp/support.rb,
lib/yt-dlp/version.rb

Overview

Version file If you are updating this code, make sure you are updating lib/yt-dlp/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'

Instance Method Summary collapse

Methods included from Support

quoted, terrapin_line, usable_executable_path_for, which

Instance Method Details

#binary_versionString

Returns yt-dlp’s version

Returns:

  • (String)

    yt-dlp version



51
52
53
# File 'lib/yt-dlp.rb', line 51

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

#download(urls, options = {}) ⇒ YtDlp::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:

  • (YtDlp::Video, Array)

    Video model or array of Video models



23
24
25
26
27
28
29
# File 'lib/yt-dlp.rb', line 23

def download(urls, options = {})
  if urls.is_a? Array
    urls.map { |url| YtDlp::Video.get(url, options) }
  else
    YtDlp::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



44
45
46
# File 'lib/yt-dlp.rb', line 44

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

#information(urls, options = {}) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/yt-dlp.rb', line 33

def information(urls, options = {})
  if urls.is_a? Array
    urls.map { |url| YtDlp::Video.information(url, options) }
  else
    YtDlp::Video.information(urls, options) # Urls should be singular but oh well. url = urls. There. Go cry in a corner.
  end
end

#user_agentString

Returns user agent

Returns:

  • (String)

    user agent



58
59
60
# File 'lib/yt-dlp.rb', line 58

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