From 6434dafe2a7ddb4697c1c481546be42121a0ab24 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 11 Jan 2009 19:46:40 -0500 Subject: [PATCH] Modified the Youtube class to accept in.youtube.com URLs. Added a test for the new behavior. --- src/websites/youtube.rb | 2 +- test/youtube_test.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/websites/youtube.rb b/src/websites/youtube.rb index b9d9aa6..3388100 100644 --- a/src/websites/youtube.rb +++ b/src/websites/youtube.rb @@ -26,7 +26,7 @@ require 'uri' class Youtube < Website - VALID_YOUTUBE_URL_REGEX = /^(http:\/\/)?(www\.)?youtube\.com\/((watch\?v=)|(v\/))[a-z0-9_\-]+(\&.*)?\#?$/i + VALID_YOUTUBE_URL_REGEX = /^(http:\/\/)?(www\.)?(in\.)?youtube\.com\/((watch\?v=)|(v\/))[a-z0-9_\-]+(\&.*)?\#?$/i def self.owns_url?(url) return url =~ VALID_YOUTUBE_URL_REGEX diff --git a/test/youtube_test.rb b/test/youtube_test.rb index cbc0375..507e43e 100644 --- a/test/youtube_test.rb +++ b/test/youtube_test.rb @@ -33,6 +33,7 @@ class YoutubeTest < Test::Unit::TestCase assert(Youtube.owns_url?('http://www.youtube.com/v/K9iDMcmm0tE')) 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')) end -- 2.44.2