Sha256: 7417e6931663f563503b3a09085a873af3ce325b5de337173487bdd6b9b3b69d
Contents?: true
Size: 620 Bytes
Versions: 3
Compression:
Stored size: 620 Bytes
Contents
# frozen_string_literal: true require 'uri' module Ffprober module Parsers class UrlParser VALID_URI_REGEX = /\A#{URI::DEFAULT_PARSER.make_regexp}\z/ def initialize(url_to_parse, exec = Ffprober::Ffmpeg::Exec.new) unless valid_url?(url_to_parse) raise ArgumentError, "#{url_to_parse} is not a valid URL" end @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) URI.escape(url) =~ VALID_URI_REGEX end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ffprober-0.5.5 | lib/ffprober/parsers/url.rb |
ffprober-0.5.3 | lib/ffprober/parsers/url.rb |
ffprober-0.5.2 | lib/ffprober/parsers/url.rb |