+ def parse_page_url(data)
+ # A simplified VALID_BLIPTV_URL_REGEX.
+ page_url_regex = /http:\/\/blip\.tv\/file\/\d+/
+ matches = page_url_regex.match(data)
+
+ if matches.nil?
+ raise StandardError.new("Couldn't parse the real page URL from the RSS page.")
+ end
+
+ return matches[0]
+ end
+
+ def parse_rss_url(url)
+ rss_id_regex = /\/flash\/(\d+)/
+ matches = rss_id_regex.match(url)
+
+ if matches.nil? or (matches.length < 2)
+ raise StandardError.new("Couldn't parse the video ID from the redirect URL: #{url}")
+ end
+
+ return "http://blip.tv/rss/flash/#{matches[1]}"
+ end
+
+ def get_redirect_url
+ uri = URI.parse(@url)
+
+ response = Net::HTTP.start(uri.host, uri.port) do |http|
+ http.get(uri.request_uri, {})
+ end
+
+ return response['location']
+ end
+
+