X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fwhatever-dl.git;a=blobdiff_plain;f=src%2Fwebsites%2Fhowcast.rb;h=5cf490e2d1dbaf77f1d428e627251392b02152b8;hp=c07d8489f31efea5e3ad98bdffb021db11cf12b7;hb=83e06f83d8274cb32a406739839d56e759664b09;hpb=2c835ed7a247ed5639277bc9674b848722ad998d diff --git a/src/websites/howcast.rb b/src/websites/howcast.rb index c07d848..5cf490e 100644 --- a/src/websites/howcast.rb +++ b/src/websites/howcast.rb @@ -26,18 +26,24 @@ class Howcast < Website return url =~ VALID_HOWCAST_URL_REGEX end - - def get_video_url(url) + + def parse_video_id() # This regex just pulls out the video id id_regex = /\/(\d+)-/ - matches = id_regex.match(url) + matches = id_regex.match(@url) if matches.nil? raise StandardError.new('The URL is a valid Howcast URL, but does not match on the digit portion of the regex. Since the digit portion is a subset of the "valid" regex, this should never occur.') end + + return matches[1] + end - video_id = matches[1] + + def get_video_url() + video_id = parse_video_id() + return "http://media.howcast.com/system/videos/#{video_id}/#{video_id}.flv" end - + end