Sha256: 8fce4a57ef6ccfa4a5eb640812789b28ed9efbebf63f47ccd2c952ef89d62514
Contents?: true
Size: 624 Bytes
Versions: 1
Compression:
Stored size: 624 Bytes
Contents
# typed: true # frozen_string_literal: true require 'uri' module Ffprober module Parsers class UrlParser VALID_URI_REGEX = /\A#{URI::DEFAULT_PARSER.make_regexp}\z/.freeze def initialize(url_to_parse, exec = Ffprober::Ffmpeg::Exec.new) raise ArgumentError, "#{url_to_parse} is not a valid URL" unless valid_url?(url_to_parse) @url_to_parse = url_to_parse @exec = exec end def load JsonParser.new(@exec.json_output(@url_to_parse)) end private def valid_url?(url) url.gsub(' ', '%20') =~ VALID_URI_REGEX end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ffprober-1.0 | lib/ffprober/parsers/url.rb |