X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fwebsites%2Fhowcast.rb;h=c8dfcd3fc12a13564bcd53c56d9ccaf81621c75a;hb=4427ec884bf38dd94256a59260613e1dff3e984a;hp=c07d8489f31efea5e3ad98bdffb021db11cf12b7;hpb=168ef3b2ccf5b97d561a3c542a18e8e7587de291;p=dead%2Fwhatever-dl.git diff --git a/src/websites/howcast.rb b/src/websites/howcast.rb index c07d848..c8dfcd3 100644 --- a/src/websites/howcast.rb +++ b/src/websites/howcast.rb @@ -26,18 +26,25 @@ 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