X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2Fwebsites%2Fefukt.rb;h=0818eacb9d24c79f98138c9ca9a98c339686eb8d;hb=8e886df259246365023322b78f58e4037cb536a4;hp=38b5913e0da242daabd80d2fc9b765972072667f;hpb=b9ebb66dc6ba56534eaa8280e6220ade7190757d;p=dead%2Fwhatever-dl.git diff --git a/src/websites/efukt.rb b/src/websites/efukt.rb index 38b5913..0818eac 100644 --- a/src/websites/efukt.rb +++ b/src/websites/efukt.rb @@ -26,7 +26,7 @@ class Efukt < Website return url =~ VALID_EFUKT_URL_REGEX end - + def get_video_url() page_data = self.get_page_data(@url) video_url = self.parse_video_url(page_data) @@ -40,7 +40,7 @@ class Efukt < Website # better than the superclass method because it doesn't rely on the # network. filename = @url.split('/').pop().split('.')[0] - + # 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 like a good @@ -49,33 +49,26 @@ class Efukt < Website matches = filename_regex.match(@url) # Overwrite the default if our regex worked. - filename = matches[1] if not (matches.nil? || matches.length < 1) - + filename = matches[1] if not matches.nil? || matches.length < 1 + return (filename + '.flv') end - + protected; - # 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 + # Get the FLV file URL from the HTML page for this movie. + # It's stored in some Flash variable. + video_url_regex = /flashvars\.file = "(http:\/\/.*\.flv)"/i matches = video_url_regex.match(page_data) - if not (matches.nil? || matches.length < 2) + if not matches.nil? || matches.length < 2 return matches[1] + else + raise StandardError.new('Could not find the "file" Flash variable.'); end - # If we didn't return a match already, try the second format. - video_url_regex = /