]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/commitdiff
Modified the Youtube class to accept in.youtube.com URLs.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 12 Jan 2009 00:46:40 +0000 (19:46 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 12 Jan 2009 00:46:40 +0000 (19:46 -0500)
Added a test for the new behavior.

src/websites/youtube.rb
test/youtube_test.rb

index b9d9aa6c5e7ec586bb69b4d851428d975a006156..3388100769b689b94e7b7ed6ef1e398ab2694f7e 100644 (file)
@@ -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
index cbc03755d8ca2bd40849de05b14fd7ee3dbaf119..507e43e3dbebcf7ed89a64ae8bd441272d6e44de 100644 (file)
@@ -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