X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fwhatever-dl.git;a=blobdiff_plain;f=src%2Fwebsites%2Fvimeo.rb;h=56243fad3ecd5d0616db0d5fdd5aa605bf01d2b2;hp=3836df1ae0edff133dc70a599a2a1951353c68bd;hb=83e06f83d8274cb32a406739839d56e759664b09;hpb=2c835ed7a247ed5639277bc9674b848722ad998d diff --git a/src/websites/vimeo.rb b/src/websites/vimeo.rb index 3836df1..56243fa 100644 --- a/src/websites/vimeo.rb +++ b/src/websites/vimeo.rb @@ -34,13 +34,13 @@ class Vimeo < Website end - def get_video_url(url) + def get_video_url() # First, figure out the video id from the URL. # Then, use the video id to construct the video details URL. # Get the video details page, and parse the resulting XML for # the junk we need to construct the video URL. Note that the file # URL given in the XML is *not* valid. - video_id = parse_video_id(url) + video_id = self.parse_video_id() details_url = "http://www.vimeo.com/moogaloop/load/clip:#{video_id}/local" details_data = get_page_data(details_url) @@ -55,20 +55,27 @@ class Vimeo < Website return video_url end + + def get_video_filename() + # The default behavior is no good here, use the video + # id with an extension tacked onto it. + return (self.parse_video_id() + '.flv') + end + protected; - def parse_video_id(url) + def parse_video_id() video_id = nil # First, try to get the video id from the end of the URL. video_id_regex = /\/(\d+)$/ - matches = video_id_regex.match(url) + matches = video_id_regex.match(@url) if matches.nil? # If that didn't work, the URL must be of the clip_id= form. video_id_regex = /clip_id\=(\d+)/ - matches = video_id_regex.match(url) + matches = video_id_regex.match(@url) video_id = matches[1] if not (matches.nil? || matches.length < 1) else video_id = matches[1] if not (matches.nil? || matches.length < 1)