From d516b60e0d6b6a212257ed09f0ed1c1972928450 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 1 Apr 2010 00:45:21 -0400 Subject: [PATCH] Added new tests for (yet another) Veoh URL format. Generalized the Veoh URL regex to accept anything ending in what looks like a video id. --- src/websites/veoh.rb | 2 +- test/veoh_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/websites/veoh.rb b/src/websites/veoh.rb index bbe448b..1400b71 100644 --- a/src/websites/veoh.rb +++ b/src/websites/veoh.rb @@ -21,7 +21,7 @@ require 'src/website' class Veoh < Website - VALID_VEOH_URL_REGEX = /^(http:\/\/)?(www\.)?veoh\.com\/((videos\/([[:alnum:]]+))|(group\/.*)|(browse\/.*\/[[:alnum:]]+))$/ + VALID_VEOH_URL_REGEX = /^(http:\/\/)?(www\.)?veoh\.com\/.*?(v[[:alnum:]]+)$/ def self.owns_url?(url) return url =~ VALID_VEOH_URL_REGEX diff --git a/test/veoh_test.rb b/test/veoh_test.rb index f28229a..fdb5bbf 100644 --- a/test/veoh_test.rb +++ b/test/veoh_test.rb @@ -48,6 +48,13 @@ class VeohTest < Test::Unit::TestCase assert_equal('v19568793XZq2SRzZ', video_id) end + + def test_parse_fifth_video_id + v = Veoh.new('http://www.veoh.com/collection/Keith-Anderson-Music-Videos/watch/v13890200h98YShYN') + video_id = v.send('parse_video_id') + assert_equal('v13890200h98YShYN', video_id) + end + def test_parse_redirect_url v = Veoh.new(nil) @@ -87,6 +94,7 @@ class VeohTest < Test::Unit::TestCase assert(Veoh.owns_url?('http://www.veoh.com/videos/v15795090Z6mZAbSq')) assert(Veoh.owns_url?('http://www.veoh.com/group/suggested-anime-w1st-episodes/?source=homepageList#watch%3Dv19961527w773Qq5G')) assert(Veoh.owns_url?('http://www.veoh.com/browse/videos/category/anime/watch/v19568793XZq2SRzZ')) + assert(Veoh.owns_url?('http://www.veoh.com/collection/Keith-Anderson-Music-Videos/watch/v13890200h98YShYN')) end end -- 2.43.2