require 'src/website'
-# Needed to download the page, which is in turn
-# needed because it contains the video (redirect) URL.
-require 'net/http'
-require 'uri'
-
class Veoh < Website
- VALID_VEOH_URL_REGEX = /^(http:\/\/)?(www\.)?veoh\.com\/videos\/([[:alnum:]]+)$/
+ VALID_VEOH_URL_REGEX = /^(http:\/\/)?(www\.)?veoh\.com\/.*?(v[[:alnum:]]+)$/
def self.owns_url?(url)
return url =~ VALID_VEOH_URL_REGEX
protected;
def parse_video_id()
- video_id_regex = /[[:alnum:]]+$/
+ video_id_regex = /v[[:alnum:]]+$/
matches = video_id_regex.match(@url)
video_id = matches[0] if not matches.nil?
def parse_redirect_url(page_data)
redirect_url_regex = /fullPreviewHashPath=\"(.*?)\"/
matches = redirect_url_regex.match(page_data)
- redirect_url = matches[1] if not (matches.nil? || matches.length < 1)
+ redirect_url = matches[1] if not (matches.nil? || matches.length < 2)
return redirect_url
end
- def get_page_data(url)
- uri = URI.parse(url)
-
- response = Net::HTTP.start(uri.host, uri.port) do |http|
- http.get(uri.path)
- end
-
- return response.body
- end
-
end