Sha256: 1e3daa32006031e11566c06620cfbf3c730c7261101f60a1dd28b8936e29cf2a

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

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

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={})
    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

  alias_method :get, :download

  # Lists extractors
  #
  # @return [Array] list of extractors
  def extractors
    @extractors ||= cocaine_line('--list-extractors').run.split("\n")
  end

  # Returns youtube-dl's version
  #
  # @return [String] youtube-dl version
  def binary_version
    @binary_version ||= cocaine_line('--version').run.strip
  end

  # Returns user agent
  #
  # @return [String] user agent
  def user_agent
    @user_agent ||= cocaine_line('--dump-user-agent').run.strip
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
youtube-dl.rb-0.2.0 lib/youtube-dl.rb