Sha256: 6a4f3422a7b4943a7571d5a4addf7089273f0d96a2386547a3bca5068520d4c4

Contents?: true

Size: 850 Bytes

Versions: 2

Compression:

Stored size: 850 Bytes

Contents

require 'youtube-dl/version'
require 'youtube-dl/support'
require 'youtube-dl/options'
require 'youtube-dl/runner'

module YoutubeDL
  extend self
  extend Support

  # Downloads given array of URLs with any options passed
  #
  # @param urls [String, Array] URLs to download
  # @param options [Hash] Downloader options
  def download(urls, options={})
    # force convert urls to array
    urls = [urls] unless urls.is_a? Array

    urls.each do |url|
      runner = YoutubeDL::Runner.new(url, YoutubeDL::Options.new(options))
      runner.run
    end
  end

  alias_method :get, :download

  def extractors
    Cocaine::CommandLine.new(usable_executable_path_for('youtube-dl'), '--list-extractors').run.split("\n")
  end

  def binary_version
    Cocaine::CommandLine.new(usable_executable_path_for('youtube-dl'), '--version').run.chomp
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
youtube-dl.rb-0.1.1 lib/youtube-dl.rb
youtube-dl.rb-0.1.0 lib/youtube-dl.rb