]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/blobdiff - src/websites/youtube.rb
Added the net/http requirement to the Website class (which now needs it).
[dead/whatever-dl.git] / src / websites / youtube.rb
index b9d9aa6c5e7ec586bb69b4d851428d975a006156..c8a1cad008fba578efd301ef53c7ee4b5bd44c6f 100644 (file)
 
 require 'src/website'
 
-# Needed to download the page, which is in turn
-# needed because it contains the video URL.
-require 'net/http'
-require 'uri'
-
 
 class Youtube < Website
 
-  VALID_YOUTUBE_URL_REGEX = /^(http:\/\/)?(www\.)?youtube\.com\/((watch\?v=)|(v\/))[a-z0-9_\-]+(\&.*)?\#?$/i
+  VALID_YOUTUBE_URL_REGEX = /^(http:\/\/)?([a-z0-9]+\.)?youtube\.com\/((watch\?v=)|(v\/))[a-z0-9_\-]+(\&.*)?\#?$/i
   
   def self.owns_url?(url)
     return url =~ VALID_YOUTUBE_URL_REGEX
@@ -97,16 +92,6 @@ class Youtube < Website
 
     return t_parameter
   end
-
   
-  def get_page_data(url)
-    uri = URI.parse(url)
-
-    response = Net::HTTP.start(uri.host, uri.port) do |http|
-      http.get(uri.request_uri)
-    end
-
-    return response.body
-  end
   
 end