youtube_addy 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/youtube_addy.rb +2 -2
- metadata +1 -1
data/lib/youtube_addy.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class YouTubeAddy
|
2
2
|
URL_Formats = {
|
3
|
-
regular: /^(https?:\/\/)?(www\.)?youtube.com\/watch\?v=([^&]+)/,
|
3
|
+
regular: /^(https?:\/\/)?(www\.)?youtube.com\/watch\?(.*\&)?v=([^&]+)/,
|
4
4
|
shortened: /^(https?:\/\/)?(www\.)?youtu.be\/([^&]+)/,
|
5
5
|
invalid_chars: /[^a-zA-Z0-9\:\/\?\=\&\$\-\_\.\+\!\*\'\(\)\,]/
|
6
6
|
}
|
@@ -13,7 +13,7 @@ class YouTubeAddy
|
|
13
13
|
return nil if has_invalid_chars?(youtube_url)
|
14
14
|
|
15
15
|
if match = URL_Formats[:regular].match(youtube_url)
|
16
|
-
return match[
|
16
|
+
return match[4]
|
17
17
|
elsif match = URL_Formats[:shortened].match(youtube_url)
|
18
18
|
return match[3]
|
19
19
|
end
|