Method: Checker.http_url_valid?
- Defined in:
- lib/youtube_dlhelper/checker.rb
.http_url_valid?(url) ⇒ Boolean
Method to check http
49 50 51 52 53 54 55 56 |
# File 'lib/youtube_dlhelper/checker.rb', line 49 def self.http_url_valid?(url) # @param [String] url Is the given URL to the Youtube file uri = URI.parse(url) response = Net::HTTP.start(uri.host, uri.port) do |http| http.head(uri.path) end response.is_a?(Net::HTTPSuccess) || response.is_a?(Net::HTTPRedirection) end |