# 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 not (matches.nil? || matches.length < 2)
+ 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)
+
if (matches.nil? || matches.length < 2)
- raise StandardError.new('Could not find the "file" flash variable on the page.');
+ raise StandardError.new('Could not find the "file" Flash variable, nor the "fileName" object parameter.');
end
return matches[1]