youtube_id 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +10 -0
- data/README.md +13 -9
- data/lib/youtube_id.rb +1 -1
- data/lib/youtube_id/version.rb +1 -1
- data/spec/youtube_id_spec.rb +5 -0
- metadata +6 -11
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Simple video id extraction from youtube urls.
|
4
4
|
|
5
|
+
[![Build Status](https://secure.travis-ci.org/reu/youtube_id.png)](http://travis-ci.org/reu/youtube_id)
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
@@ -22,14 +24,16 @@ Or install it yourself as:
|
|
22
24
|
YoutubeID.from("http//www.youtube.com/watch?v=RCUkmUXMd_k") # => "RCUkmUXMd_k"
|
23
25
|
```
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
27
|
+
It supports these url formats:
|
28
|
+
```
|
29
|
+
http://www.youtube.com/v/RCUkmUXMd_k
|
30
|
+
http://www.youtube.com/v/RCUkmUXMd_k?version=3&hl=en_US&rel=0
|
31
|
+
http://www.youtube.com/embed/RCUkmUXMd_k?rel=0
|
32
|
+
http://www.youtube.com/watch?v=RCUkmUXMd_k
|
33
|
+
http://www.youtube.com/watch?v=RCUkmUXMd_k&feature=related
|
34
|
+
http://www.youtube.com/watch?v=RCUkmUXMd_k#t=0m10s
|
35
|
+
http://www.youtube.com/user/ForceD3strategy#p/a/u/0/8WVTOUh53QY
|
36
|
+
http://youtu.be/RCUkmUXMd_k
|
37
|
+
```
|
34
38
|
|
35
39
|
See the specs for more detailed information.
|
data/lib/youtube_id.rb
CHANGED
@@ -2,7 +2,7 @@ require "youtube_id/version"
|
|
2
2
|
|
3
3
|
module YoutubeID
|
4
4
|
FORMATS = [
|
5
|
-
%r(https?://youtu\.be/(
|
5
|
+
%r(https?://youtu\.be/(.+)),
|
6
6
|
%r(https?://www\.youtube\.com/watch\?v=(.*?)(&|#|$)),
|
7
7
|
%r(https?://www\.youtube\.com/embed/(.*?)(\?|$)),
|
8
8
|
%r(https?://www\.youtube\.com/v/(.*?)(#|\?|$)),
|
data/lib/youtube_id/version.rb
CHANGED
data/spec/youtube_id_spec.rb
CHANGED
@@ -49,6 +49,11 @@ describe YoutubeID do
|
|
49
49
|
let(:url) { "#{protocol}://youtu.be/RCUkmUXMd_k" }
|
50
50
|
it { should == "RCUkmUXMd_k" }
|
51
51
|
end
|
52
|
+
|
53
|
+
context "shor url format with dashes", "//youtu.be/Hu0i--4tz0N" do
|
54
|
+
let(:url) { "#{protocol}://youtu.be/Hu0i--4tz0N" }
|
55
|
+
it { should == "Hu0i--4tz0N" }
|
56
|
+
end
|
52
57
|
end
|
53
58
|
end
|
54
59
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: youtube_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-05-
|
14
|
+
date: 2012-05-14 00:00:00.000000000Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|
18
|
-
requirement: &
|
18
|
+
requirement: &2156592900 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
version: '0'
|
24
24
|
type: :development
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *2156592900
|
27
27
|
description: Easily extract the video id from youtube videos urls
|
28
28
|
email:
|
29
29
|
- rnavarro1@gmail.com
|
@@ -34,6 +34,7 @@ extensions: []
|
|
34
34
|
extra_rdoc_files: []
|
35
35
|
files:
|
36
36
|
- .gitignore
|
37
|
+
- .travis.yml
|
37
38
|
- Gemfile
|
38
39
|
- LICENSE
|
39
40
|
- README.md
|
@@ -54,21 +55,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
55
|
- - ! '>='
|
55
56
|
- !ruby/object:Gem::Version
|
56
57
|
version: '0'
|
57
|
-
segments:
|
58
|
-
- 0
|
59
|
-
hash: -1505085228670528075
|
60
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
59
|
none: false
|
62
60
|
requirements:
|
63
61
|
- - ! '>='
|
64
62
|
- !ruby/object:Gem::Version
|
65
63
|
version: '0'
|
66
|
-
segments:
|
67
|
-
- 0
|
68
|
-
hash: -1505085228670528075
|
69
64
|
requirements: []
|
70
65
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.8.
|
66
|
+
rubygems_version: 1.8.17
|
72
67
|
signing_key:
|
73
68
|
specification_version: 3
|
74
69
|
summary: Easily extract the video id from youtube videos urls
|