Added a test to ensure that uk.youtube.com URLs are handled properly.
class Youtube < Website
- VALID_YOUTUBE_URL_REGEX = /^(http:\/\/)?(www\.)?(in\.)?youtube\.com\/((watch\?v=)|(v\/))[a-z0-9_\-]+(\&.*)?\#?$/i
+ VALID_YOUTUBE_URL_REGEX = /^(http:\/\/)?([a-z0-9]+\.)?youtube\.com\/((watch\?v=)|(v\/))[a-z0-9_\-]+(\&.*)?\#?$/i
def self.owns_url?(url)
return url =~ VALID_YOUTUBE_URL_REGEX
assert(Youtube.owns_url?('http://www.youtube.com/watch?v=83-hlYMH1XE'))
assert(Youtube.owns_url?('http://www.youtube.com/watch?v=83-hlYMH1XE&feature=dir'))
assert(Youtube.owns_url?('http://in.youtube.com/watch?v=VcydqSpYN00&feature=channel_page'))
+ assert(Youtube.owns_url?('http://uk.youtube.com/watch?v=LN4Ov6ZLcrI'))
end