yt-url 1.0.0.beta1 → 1.0.0.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +11 -11
- data/lib/yt/url.rb +6 -7
- data/lib/yt/url/version.rb +1 -1
- data/spec/id_spec.rb +3 -3
- data/spec/resource_spec.rb +3 -5
- data/yt-url.gemspec +11 -12
- metadata +20 -39
- data/bin/yt-url +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2618aa48886e44a3c874fc3d6c2ec1e46a45ff8b
|
4
|
+
data.tar.gz: f7728d1819486c079fb75315ec7da131ba27132a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aff9ced79af1c921bade6c03137c48c90b6a68eaacb575a92d770e6c3675460de9bd53e60da1416a729c9a54869ac8589868a8cf20c3593a2a4da3601c5c7830
|
7
|
+
data.tar.gz: 1ea415b5b7047383c05d8703af843135ad9e59ba27c754de471dc0d8aad21fba93d1ef1bc409487db62f7832acd65fafbded299963396efdb04635aa28f719ee
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,11 @@ For more information about changelogs, check
|
|
6
6
|
[Keep a Changelog](http://keepachangelog.com) and
|
7
7
|
[Vandamme](http://tech-angels.github.io/vandamme).
|
8
8
|
|
9
|
+
## 1.0.0.beta2 - 2017-03-04
|
10
|
+
|
11
|
+
* [ENHANCEMENT] Remove dependency from 'activesupport'
|
12
|
+
* [ENHANCEMENT] Change dependency from 'yt' to the smaller 'yt-core'
|
13
|
+
|
9
14
|
## 1.0.0.beta1 - 2017-02-26
|
10
15
|
|
11
16
|
* [FEATURE] Extracted Yt::URL module from Yt
|
data/LICENSE.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
3
|
Copyright (c) 2016–present Fullscreen, Inc.
|
4
|
-
|
4
|
+
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
7
7
|
in the Software without restriction, including without limitation the rights
|
data/README.md
CHANGED
@@ -3,16 +3,16 @@ Yt::URL - a URL extension for the Yt library
|
|
3
3
|
|
4
4
|
Yt::URL helps you identify YouTube resources from their URL.
|
5
5
|
|
6
|
-
The **source code** is available on [GitHub](https://github.com/
|
6
|
+
The **source code** is available on [GitHub](https://github.com/fullscreen/yt-url) and the **documentation** on [RubyDoc](http://www.rubydoc.info/gems/yt-url/frames).
|
7
7
|
|
8
|
-
[](https://travis-ci.org/Fullscreen/yt-url)
|
9
|
+
[](https://coveralls.io/r/Fullscreen/yt-url)
|
10
|
+
[](https://gemnasium.com/Fullscreen/yt-url)
|
11
|
+
[](https://codeclimate.com/github/Fullscreen/yt-url)
|
12
12
|
[](http://www.rubydoc.info/gems/yt-url/frames)
|
13
13
|
[](http://rubygems.org/gems/yt-url)
|
14
14
|
|
15
|
-
After [registering your app](https://
|
15
|
+
After [registering your app](https://fullscreen.github.io/yt-core/), you can run commands like:
|
16
16
|
|
17
17
|
```ruby
|
18
18
|
url = Yt::URL.new "youtu.be/gknzFj_0vvY"
|
@@ -27,11 +27,11 @@ The **full documentation** is available at [rubydoc.info](http://www.rubydoc.inf
|
|
27
27
|
A comprehensive guide to Yt
|
28
28
|
===========================
|
29
29
|
|
30
|
-
All the classes and methods available are detailed on the [Yt homepage](https://
|
30
|
+
All the classes and methods available are detailed on the [Yt homepage](https://fullscreen.github.io/yt-core/):
|
31
31
|
|
32
|
-
[](https://
|
32
|
+
[](https://fullscreen.github.io/yt-core/)
|
33
33
|
|
34
|
-
Please proceed to [https://
|
34
|
+
Please proceed to [https://fullscreen.github.io/yt-core/urls.html](https://fullscreen.github.io/yt-core/urls.html) for more details and examples.
|
35
35
|
|
36
36
|
|
37
37
|
How to install
|
@@ -43,7 +43,7 @@ To install on your system, run
|
|
43
43
|
|
44
44
|
To use inside a bundled Ruby project, add this line to the Gemfile:
|
45
45
|
|
46
|
-
gem 'yt-url', '~> 0.0.
|
46
|
+
gem 'yt-url', '~> 1.0.0.beta2'
|
47
47
|
|
48
48
|
Since the gem follows [Semantic Versioning](http://semver.org),
|
49
49
|
indicating the full version in your Gemfile (~> *major*.*minor*.*patch*)
|
@@ -75,7 +75,7 @@ How to release new versions
|
|
75
75
|
If you are a manager of this project, remember to upgrade the [Yt gem](http://rubygems.org/gems/yt-url)
|
76
76
|
whenever a new feature is added or a bug gets fixed.
|
77
77
|
|
78
|
-
Make sure all the tests are passing on [Travis CI](https://travis-ci.org/
|
78
|
+
Make sure all the tests are passing on [Travis CI](https://travis-ci.org/fullscreen/yt-url),
|
79
79
|
document the changes in HISTORY.md and README.md, bump the version, then run
|
80
80
|
|
81
81
|
rake release
|
data/lib/yt/url.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'yt'
|
1
|
+
require 'yt/core'
|
2
2
|
|
3
3
|
# An object-oriented Ruby client for YouTube.
|
4
4
|
# @see http://www.rubydoc.info/gems/yt/
|
@@ -26,7 +26,7 @@ module Yt
|
|
26
26
|
|
27
27
|
# @return [<String, nil>] the ID of the YouTube resource matching the URL.
|
28
28
|
def id
|
29
|
-
@match[
|
29
|
+
@match['id'] ||= fetch_id
|
30
30
|
end
|
31
31
|
|
32
32
|
# @return [<Yt::Channel>] the resource associated with the URL
|
@@ -35,7 +35,7 @@ module Yt
|
|
35
35
|
when :channel then Yt::Channel
|
36
36
|
when :video then Yt::Video
|
37
37
|
when :playlist then Yt::Playlist
|
38
|
-
else raise Yt::
|
38
|
+
else raise Yt::NoItemsError
|
39
39
|
end.new options.merge(id: id)
|
40
40
|
end
|
41
41
|
|
@@ -66,8 +66,7 @@ module Yt
|
|
66
66
|
patterns.find(-> {{kind: :unknown}}) do |kind, regex|
|
67
67
|
if data = @text.match(regex)
|
68
68
|
# Note: With Ruby 2.4, the following is data.named_captures
|
69
|
-
|
70
|
-
break match.merge kind: kind
|
69
|
+
break data.names.zip(data.captures).to_h.merge kind: kind
|
71
70
|
end
|
72
71
|
end
|
73
72
|
end
|
@@ -84,7 +83,7 @@ module Yt
|
|
84
83
|
|
85
84
|
def fetch_id
|
86
85
|
response = Net::HTTP.start 'www.youtube.com', 443, use_ssl: true do |http|
|
87
|
-
http.request Net::HTTP::Get.new("/#{@match[
|
86
|
+
http.request Net::HTTP::Get.new("/#{@match['format']}#{@match['name']}")
|
88
87
|
end
|
89
88
|
if response.is_a?(Net::HTTPRedirection)
|
90
89
|
response = Net::HTTP.start 'www.youtube.com', 443, use_ssl: true do |http|
|
@@ -95,7 +94,7 @@ module Yt
|
|
95
94
|
if data = response.body.match(regex)
|
96
95
|
data[:id]
|
97
96
|
else
|
98
|
-
raise Yt::
|
97
|
+
raise Yt::NoItemsError
|
99
98
|
end
|
100
99
|
end
|
101
100
|
end
|
data/lib/yt/url/version.rb
CHANGED
data/spec/id_spec.rb
CHANGED
@@ -32,7 +32,7 @@ describe 'Yt::URL#id' do
|
|
32
32
|
|
33
33
|
describe 'fails with unknown channels' do
|
34
34
|
let(:name) { 'not-an-actual-channel' }
|
35
|
-
it {expect{url.id}.to raise_error Yt::
|
35
|
+
it {expect{url.id}.to raise_error Yt::NoItemsError }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -46,7 +46,7 @@ describe 'Yt::URL#id' do
|
|
46
46
|
|
47
47
|
describe 'fails with unknown channels' do
|
48
48
|
let(:name) { 'not-an-actual-channel' }
|
49
|
-
it {expect{url.id}.to raise_error Yt::
|
49
|
+
it {expect{url.id}.to raise_error Yt::NoItemsError }
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -60,7 +60,7 @@ describe 'Yt::URL#id' do
|
|
60
60
|
|
61
61
|
describe 'fails with unknown channels' do
|
62
62
|
let(:name) { 'not-an-actual-channel' }
|
63
|
-
it {expect{url.id}.to raise_error Yt::
|
63
|
+
it {expect{url.id}.to raise_error Yt::NoItemsError }
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
data/spec/resource_spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe 'Yt::URL#resource', :server do
|
|
21
21
|
let(:text) { "youtu.be/#{$unknown_video_id}" }
|
22
22
|
|
23
23
|
it {expect(url.resource).to be_a Yt::Video }
|
24
|
-
it {expect{url.resource.title}.to raise_error Yt::
|
24
|
+
it {expect{url.resource.title}.to raise_error Yt::NoItemsError }
|
25
25
|
end
|
26
26
|
|
27
27
|
context 'given an existing YouTube playlist URL' do
|
@@ -35,14 +35,12 @@ describe 'Yt::URL#resource', :server do
|
|
35
35
|
let(:text) { "https://www.youtube.com/playlist?list=#{$unknown_playlist_id}" }
|
36
36
|
|
37
37
|
it {expect(url.resource).to be_a Yt::Playlist }
|
38
|
-
it {expect{url.resource.title}.to raise_error Yt::
|
38
|
+
it {expect{url.resource.title}.to raise_error Yt::NoItemsError }
|
39
39
|
end
|
40
40
|
|
41
41
|
context 'given an unknown text' do
|
42
42
|
let(:text) { $unknown_text }
|
43
43
|
|
44
|
-
it {expect{url.resource}.to raise_error Yt::
|
44
|
+
it {expect{url.resource}.to raise_error Yt::NoItemsError }
|
45
45
|
end
|
46
|
-
|
47
46
|
end
|
48
|
-
|
data/yt-url.gemspec
CHANGED
@@ -4,15 +4,15 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'yt/url/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'yt-url'
|
8
8
|
spec.version = Yt::URL::VERSION
|
9
|
-
spec.authors = ['Claudio Baccigalupo']
|
10
|
-
spec.email = ['claudio@fullscreen.net']
|
9
|
+
spec.authors = ['Claudio Baccigalupo', 'Kang-Kyu Lee']
|
10
|
+
spec.email = ['claudio@fullscreen.net', 'kang-kyu.lee@fullscreen.net']
|
11
11
|
spec.description = %q{URL Extension for the Yt library.}
|
12
12
|
spec.summary = %q{Yt::URL helps identify which YouTube resource (video,
|
13
13
|
channel, playlist) matches a YouTube URL in any given form.}
|
14
|
-
spec.homepage = 'http://github.com/
|
15
|
-
spec.license =
|
14
|
+
spec.homepage = 'http://github.com/fullscreen/yt-url'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.required_ruby_version = '>= 2.2.2'
|
18
18
|
|
@@ -22,13 +22,12 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.add_dependency '
|
26
|
-
spec.add_dependency 'yt', '>= 0.29'
|
25
|
+
spec.add_dependency 'yt-core', '>= 0.1.0'
|
27
26
|
|
28
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.14'
|
29
28
|
spec.add_development_dependency 'rspec', '~> 3.5'
|
30
|
-
spec.add_development_dependency 'rake', '~>
|
31
|
-
spec.add_development_dependency 'coveralls', '~> 0.8.
|
32
|
-
spec.add_development_dependency '
|
33
|
-
spec.add_development_dependency 'yard', '~> 0.9.
|
29
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
30
|
+
spec.add_development_dependency 'coveralls', '~> 0.8.20'
|
31
|
+
spec.add_development_dependency 'pry-nav', '~> 0.2.4'
|
32
|
+
spec.add_development_dependency 'yard', '~> 0.9.8'
|
34
33
|
end
|
metadata
CHANGED
@@ -1,63 +1,44 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yt-url
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
8
|
+
- Kang-Kyu Lee
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date: 2017-
|
12
|
+
date: 2017-04-03 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
+
name: yt-core
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
18
|
- - ">="
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '6'
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '5'
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '6'
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: yt
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '0.29'
|
20
|
+
version: 0.1.0
|
40
21
|
type: :runtime
|
41
22
|
prerelease: false
|
42
23
|
version_requirements: !ruby/object:Gem::Requirement
|
43
24
|
requirements:
|
44
25
|
- - ">="
|
45
26
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
27
|
+
version: 0.1.0
|
47
28
|
- !ruby/object:Gem::Dependency
|
48
29
|
name: bundler
|
49
30
|
requirement: !ruby/object:Gem::Requirement
|
50
31
|
requirements:
|
51
32
|
- - "~>"
|
52
33
|
- !ruby/object:Gem::Version
|
53
|
-
version: '1.
|
34
|
+
version: '1.14'
|
54
35
|
type: :development
|
55
36
|
prerelease: false
|
56
37
|
version_requirements: !ruby/object:Gem::Requirement
|
57
38
|
requirements:
|
58
39
|
- - "~>"
|
59
40
|
- !ruby/object:Gem::Version
|
60
|
-
version: '1.
|
41
|
+
version: '1.14'
|
61
42
|
- !ruby/object:Gem::Dependency
|
62
43
|
name: rspec
|
63
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,59 +59,60 @@ dependencies:
|
|
78
59
|
requirements:
|
79
60
|
- - "~>"
|
80
61
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
62
|
+
version: '12.0'
|
82
63
|
type: :development
|
83
64
|
prerelease: false
|
84
65
|
version_requirements: !ruby/object:Gem::Requirement
|
85
66
|
requirements:
|
86
67
|
- - "~>"
|
87
68
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
69
|
+
version: '12.0'
|
89
70
|
- !ruby/object:Gem::Dependency
|
90
71
|
name: coveralls
|
91
72
|
requirement: !ruby/object:Gem::Requirement
|
92
73
|
requirements:
|
93
74
|
- - "~>"
|
94
75
|
- !ruby/object:Gem::Version
|
95
|
-
version: 0.8.
|
76
|
+
version: 0.8.20
|
96
77
|
type: :development
|
97
78
|
prerelease: false
|
98
79
|
version_requirements: !ruby/object:Gem::Requirement
|
99
80
|
requirements:
|
100
81
|
- - "~>"
|
101
82
|
- !ruby/object:Gem::Version
|
102
|
-
version: 0.8.
|
83
|
+
version: 0.8.20
|
103
84
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
85
|
+
name: pry-nav
|
105
86
|
requirement: !ruby/object:Gem::Requirement
|
106
87
|
requirements:
|
107
88
|
- - "~>"
|
108
89
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
90
|
+
version: 0.2.4
|
110
91
|
type: :development
|
111
92
|
prerelease: false
|
112
93
|
version_requirements: !ruby/object:Gem::Requirement
|
113
94
|
requirements:
|
114
95
|
- - "~>"
|
115
96
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
97
|
+
version: 0.2.4
|
117
98
|
- !ruby/object:Gem::Dependency
|
118
99
|
name: yard
|
119
100
|
requirement: !ruby/object:Gem::Requirement
|
120
101
|
requirements:
|
121
102
|
- - "~>"
|
122
103
|
- !ruby/object:Gem::Version
|
123
|
-
version: 0.9.
|
104
|
+
version: 0.9.8
|
124
105
|
type: :development
|
125
106
|
prerelease: false
|
126
107
|
version_requirements: !ruby/object:Gem::Requirement
|
127
108
|
requirements:
|
128
109
|
- - "~>"
|
129
110
|
- !ruby/object:Gem::Version
|
130
|
-
version: 0.9.
|
111
|
+
version: 0.9.8
|
131
112
|
description: URL Extension for the Yt library.
|
132
113
|
email:
|
133
114
|
- claudio@fullscreen.net
|
115
|
+
- kang-kyu.lee@fullscreen.net
|
134
116
|
executables: []
|
135
117
|
extensions: []
|
136
118
|
extra_rdoc_files: []
|
@@ -145,7 +127,6 @@ files:
|
|
145
127
|
- Rakefile
|
146
128
|
- bin/console
|
147
129
|
- bin/setup
|
148
|
-
- bin/yt-url
|
149
130
|
- lib/yt/url.rb
|
150
131
|
- lib/yt/url/version.rb
|
151
132
|
- spec/id_spec.rb
|
@@ -154,7 +135,7 @@ files:
|
|
154
135
|
- spec/spec_helper.rb
|
155
136
|
- spec/support/server.rb
|
156
137
|
- yt-url.gemspec
|
157
|
-
homepage: http://github.com/
|
138
|
+
homepage: http://github.com/fullscreen/yt-url
|
158
139
|
licenses:
|
159
140
|
- MIT
|
160
141
|
metadata: {}
|
@@ -174,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
155
|
version: 1.3.1
|
175
156
|
requirements: []
|
176
157
|
rubyforge_project:
|
177
|
-
rubygems_version: 2.6.
|
158
|
+
rubygems_version: 2.6.11
|
178
159
|
signing_key:
|
179
160
|
specification_version: 4
|
180
161
|
summary: Yt::URL helps identify which YouTube resource (video, channel, playlist)
|
data/bin/yt-url
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# @example bundle exec bin/yt-url "HBO,trueblood"
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'yt/url'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'yt/url'
|
9
|
-
end
|
10
|
-
|
11
|
-
Yt.configuration.api_key = ENV['YT_SERVER_API_KEY']
|
12
|
-
|
13
|
-
puts "id\tchannel"
|
14
|
-
ARGV[0].split(',').each do |text|
|
15
|
-
url = Yt::URL.new text
|
16
|
-
id = begin
|
17
|
-
url.id
|
18
|
-
rescue Yt::Errors::NoItems
|
19
|
-
'?' * 24
|
20
|
-
end
|
21
|
-
puts "#{id}\t#{text}"
|
22
|
-
end
|