]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/blobdiff - src/websites/youtube.rb
Factored out the Youtube implementation of get_page_data into the Website superclass.
[dead/whatever-dl.git] / src / websites / youtube.rb
index 3388100769b689b94e7b7ed6ef1e398ab2694f7e..c124f5339177f41c5a9360cde51700464d28be87 100644 (file)
@@ -26,7 +26,7 @@ require 'uri'
 
 class Youtube < Website
 
-  VALID_YOUTUBE_URL_REGEX = /^(http:\/\/)?(www\.)?(in\.)?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 +97,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