]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/commitdiff
Added a new URL format for the Youtube class.
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 31 Mar 2010 18:56:21 +0000 (14:56 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 31 Mar 2010 18:56:21 +0000 (14:56 -0400)
Created a test for the new URL format.

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

index 532d8cae4653560fec7341d91d2328ca47027e12..ee9a1152c2a6c9e05f230a1c9dfacc12823bb545 100644 (file)
@@ -21,7 +21,7 @@ require 'cgi'
 
 class Youtube < Website
 
-  VALID_YOUTUBE_URL_REGEX = /^(http:\/\/)?([a-z0-9]+\.)?youtube\.com\/((watch\?v=)|(v\/))[a-z0-9_\-]+(\&.*)?\#?$/i
+  VALID_YOUTUBE_URL_REGEX = /^(http:\/\/)?([a-z0-9]+\.)?youtube\.com\/((watch\?v=)|(v\/)|([a-z]+\#[a-z]\/[a-z]\/[0-9]\/))[a-z0-9_\-]+(\&.*)?\#?$/i
   
   def self.owns_url?(url)
     return url =~ VALID_YOUTUBE_URL_REGEX
index ec91d357112a2c1b6e24e6cbd41bb15653d4a16f..ab92f2d115123e6f5e40576ce8a034436012b9fe 100644 (file)
@@ -35,6 +35,7 @@ class YoutubeTest < Test::Unit::TestCase
     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'))
+    assert(Youtube.owns_url?('http://www.youtube.com/meetlocalbiz#p/u/0/rJVWV4aA6Jk'))
   end