]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/blobdiff - src/websites/efukt.rb
Added support for a second filename pattern to the Efukt class.
[dead/whatever-dl.git] / src / websites / efukt.rb
index f4cc58d663b236af75cf8072c0025dbb58259714..38b5913e0da242daabd80d2fc9b765972072667f 100644 (file)
@@ -43,7 +43,7 @@ class Efukt < Website
     
     # Most of the URLs will just be the video's id,
     # followed by an underscore and the video title (with
-    # all spaces replaced by underscores. Sounds look a good
+    # all spaces replaced by underscores. Sounds like a good
     # filename to me.
     filename_regex = /\/([[:alnum:]_]+)\.html/
     matches = filename_regex.match(@url)
@@ -60,26 +60,24 @@ class Efukt < Website
   # Get the FLV file URL from the HTML page for this movie.
   # It's stored in some Flash variable.
   def parse_video_url(page_data)
+    # There are two formats; try them both one at a time.
     video_url_regex = /&file=(http:\/\/.*\.flv)&/i
     matches = video_url_regex.match(page_data)
 
-    if (matches.nil? || matches.length < 2)
-      raise StandardError.new('Could not find the "file" flash variable on the page.');
+    if not (matches.nil? || matches.length < 2)
+      return matches[1]
     end
-    
-    return matches[1]
-  end
 
+    # If we didn't return a match already, try the second format.
+    video_url_regex = /<param name='fileName' value="(.*?)"/i
+    matches = video_url_regex.match(page_data)
 
-  # 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)
+    if (matches.nil? || matches.length < 2)
+      raise StandardError.new('Could not find the "file" Flash variable, nor the "fileName" object parameter.');
     end
     
-    return response.body
+    return matches[1]
   end
 
+
 end