]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/commitdiff
Factored out the Youtube implementation of get_page_data into the Website superclass.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 21 Mar 2009 04:35:54 +0000 (00:35 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 21 Mar 2009 04:35:54 +0000 (00:35 -0400)
src/website.rb
src/websites/efukt.rb
src/websites/fuckedtube.rb
src/websites/infoq.rb
src/websites/veoh.rb
src/websites/vimeo.rb
src/websites/youtube.rb

index b5a501f9db8184d403d93ee1c13a34900b10506d..5e064799cd3ede567d732e1f3e2f5c8f72aaf51a 100644 (file)
@@ -48,6 +48,21 @@ class Website
     return uri.host
   end
 
+
+  
+  def get_page_data(url)
+    # A naive implementation that just grabs the
+    # data from a page.
+    uri = URI.parse(url)
+
+    response = Net::HTTP.start(uri.host, uri.port) do |http|
+      http.get(uri.request_uri)
+    end
+
+    return response.body
+  end
+
+  
   
   public;
 
index f4cc58d663b236af75cf8072c0025dbb58259714..4d5d397d24e1fa093927d1fce749aae228494f57 100644 (file)
@@ -71,15 +71,4 @@ class Efukt < Website
   end
 
 
-  # Just make a normal HTTP "get" request.
-  def get_page_data(url)
-    uri = URI.parse(url)
-    
-    response = Net::HTTP.start(uri.host, uri.port) do |http|
-      http.get(uri.path)
-    end
-    
-    return response.body
-  end
-
 end
index dfde083bdc94c1ee1e7fa5a6bd832bdbfd4870b8..c8b6ca7123450d94c4578906da82489a5611f35b 100644 (file)
@@ -50,15 +50,4 @@ class Fuckedtube < Website
   end
 
 
-  # Just make a normal HTTP "get" request.
-  def get_page_data(url)
-    uri = URI.parse(url)
-    
-    response = Net::HTTP.start(uri.host, uri.port) do |http|
-      http.get(uri.path)
-    end
-    
-    return response.body
-  end
-
 end
index dca55fa5527dbd2dd5ffbbd932c409c89a2e2e84..1829c8c2c5fd846682adb63b9e3b9b9e6b132585 100644 (file)
@@ -55,15 +55,4 @@ class Infoq < Website
   end
 
 
-  # Just make a normal HTTP "get" request.
-  def get_page_data(url)
-    uri = URI.parse(url)
-    
-    response = Net::HTTP.start(uri.host, uri.port) do |http|
-      http.get(uri.path)
-    end
-    
-    return response.body
-  end
-
 end
index c961d688e213b9500db2ab20726e966b2d896894..8978febf855ec4bfd38abf6ab50840020f1559b4 100644 (file)
@@ -77,14 +77,4 @@ class Veoh < Website
   end
   
   
-  def get_page_data(url)
-    uri = URI.parse(url)
-
-    response = Net::HTTP.start(uri.host, uri.port) do |http|
-      http.get(uri.path)
-    end
-    
-    return response.body
-  end
-  
 end
index 56243fad3ecd5d0616db0d5fdd5aa605bf01d2b2..b3dfe74c16f2630df10ac4c8ea07d0ae2e7ada0d 100644 (file)
@@ -119,14 +119,4 @@ class Vimeo < Website
   end
 
   
-  def get_page_data(url)
-    uri = URI.parse(url)
-    
-    response = Net::HTTP.start(uri.host, uri.port) do |http|
-      http.get(uri.path)
-    end
-    
-    return response.body
-  end
-  
 end
index cbda4e27d77d0ac1001b87ba83753cf8b8dc5175..c124f5339177f41c5a9360cde51700464d28be87 100644 (file)
@@ -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