video_info 2.5.0 → 2.6.0

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.
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: video_info
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibaud Guillaume-Gentil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-13 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '2.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: multi_json
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,58 +42,72 @@ dependencies:
42
42
  name: htmlentities
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '4.3'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '4.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: iso8601
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '0.9'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '0.9'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: oga
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '2.2'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '2.2'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: open_uri_redirections
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '0.2'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '0.2'
97
+ - !ruby/object:Gem::Dependency
98
+ name: net_http_timeout_errors
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.3.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.3.0
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: bundler
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -193,11 +207,13 @@ files:
193
207
  - LICENSE.txt
194
208
  - README.md
195
209
  - Rakefile
210
+ - foo.txt
196
211
  - lib/video_info.rb
197
212
  - lib/video_info/provider.rb
198
213
  - lib/video_info/providers/dailymotion.rb
199
214
  - lib/video_info/providers/vimeo.rb
200
- - lib/video_info/providers/vimeoplaylist.rb
215
+ - lib/video_info/providers/vimeo_api.rb
216
+ - lib/video_info/providers/vimeo_scraper.rb
201
217
  - lib/video_info/providers/vkontakte.rb
202
218
  - lib/video_info/providers/wistia.rb
203
219
  - lib/video_info/providers/youtube.rb
@@ -209,7 +225,7 @@ files:
209
225
  - lib/video_info/version.rb
210
226
  - spec/lib/video_info/provider_spec.rb
211
227
  - spec/lib/video_info/providers/dailymotion_spec.rb
212
- - spec/lib/video_info/providers/vimeo_playlist_spec.rb
228
+ - spec/lib/video_info/providers/vimeo_api_spec.rb
213
229
  - spec/lib/video_info/providers/vimeo_spec.rb
214
230
  - spec/lib/video_info/providers/vkontakte_spec.rb
215
231
  - spec/lib/video_info/providers/wistia_spec.rb
@@ -240,14 +256,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
256
  version: '0'
241
257
  requirements: []
242
258
  rubyforge_project:
243
- rubygems_version: 2.4.8
259
+ rubygems_version: 2.5.1
244
260
  signing_key:
245
261
  specification_version: 4
246
262
  summary: Dailymotion, Vimeo, VK and YouTube info parser.
247
263
  test_files:
248
264
  - spec/lib/video_info/provider_spec.rb
249
265
  - spec/lib/video_info/providers/dailymotion_spec.rb
250
- - spec/lib/video_info/providers/vimeo_playlist_spec.rb
266
+ - spec/lib/video_info/providers/vimeo_api_spec.rb
251
267
  - spec/lib/video_info/providers/vimeo_spec.rb
252
268
  - spec/lib/video_info/providers/vkontakte_spec.rb
253
269
  - spec/lib/video_info/providers/wistia_spec.rb
@@ -1,63 +0,0 @@
1
- class VideoInfo
2
- module Providers
3
- class VimeoPlaylist < Vimeo
4
- alias_method :playlist_id, :video_id
5
-
6
- def self.usable?(url)
7
- url =~ /((vimeo\.com)\/album)|((vimeo\.com)\/hubnut\/album)/
8
- end
9
-
10
- def videos
11
- @videos ||= _data_videos.map do |video_data|
12
- video = Vimeo.new(video_data['link'])
13
- video.data = video
14
- video
15
- end
16
- end
17
-
18
- def embed_url
19
- "//player.vimeo.com/hubnut/album/#{playlist_id}"
20
- end
21
-
22
- %w[width height keywords view_count].each do |method|
23
- define_method(method) { nil }
24
- end
25
-
26
- private
27
-
28
- def _video
29
- data
30
- end
31
-
32
- def _url_regex
33
- /vimeo.com\/album\/([0-9]*)|vimeo.com\/hubnut\/album\/([0-9]*)/
34
- end
35
-
36
- def _api_path
37
- "/albums/#{playlist_id}"
38
- end
39
-
40
- def _api_path_album_videos
41
- "/albums/#{playlist_id}/videos"
42
- end
43
-
44
- def _api_videos_path
45
- "/videos/#{video_id}"
46
- end
47
-
48
- def _api_videos_url
49
- "https://#{_api_base}#{_api_path_album_videos}"
50
- end
51
-
52
- def _data_videos
53
- @data_videos ||= _set_videos_from_api
54
- end
55
-
56
- def _set_videos_from_api
57
- uri = open(_api_videos_url, options)
58
- json = MultiJson.load(uri.read)
59
- json['data']
60
- end
61
- end
62
- end
63
- end
@@ -1,157 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe VideoInfo::Providers::VimeoPlaylist do
4
- before(:all) do
5
- VideoInfo.provider_api_keys = { vimeo: '6b66b015a3504793b4f541d878f46ff6' }
6
- end
7
-
8
- describe '.usable?' do
9
- subject { VideoInfo::Providers::VimeoPlaylist.usable?(url) }
10
-
11
- context 'with vimeo album url' do
12
- let(:url) { 'http://vimeo.com/album/2755718' }
13
- it { is_expected.to be_truthy }
14
- end
15
-
16
- context 'with vimeo hubnub embed url' do
17
- let(:url) { 'http://player.vimeo.com/hubnut/album/2755718' }
18
- it { is_expected.to be_truthy }
19
- end
20
-
21
- context 'with vimeo url' do
22
- let(:url) { 'http://www.vimeo.com/898029' }
23
- it { is_expected.to be_falsey }
24
- end
25
-
26
- context 'with other url' do
27
- let(:url) { 'http://www.youtube.com/898029' }
28
- it { is_expected.to be_falsey }
29
- end
30
- end
31
-
32
- describe '#available?' do
33
- context 'with valid playlist', :vcr do
34
- subject { VideoInfo.new('http://vimeo.com/album/2755718') }
35
-
36
- describe '#available?' do
37
- subject { super().available? }
38
- it { is_expected.to be_truthy }
39
- end
40
- end
41
-
42
- context 'with invalid playlist', :vcr do
43
- subject { VideoInfo.new('http://vimeo.com/album/2') }
44
-
45
- describe '#available?' do
46
- subject { super().available? }
47
- it { is_expected.to be_falsey }
48
- end
49
- end
50
- end
51
-
52
- context 'with playlist 1921098', :vcr do
53
- let(:videos) {
54
- [
55
- 39837353, 40170418, 38809325, 38445453,
56
- 38445381, 38445243, 38394965, 42647970
57
- ].map do |video_id|
58
- VideoInfo.new("https://vimeo.com/#{video_id}")
59
- end
60
- }
61
- subject { VideoInfo.new('http://vimeo.com/album/1921098') }
62
-
63
- describe '#provider' do
64
- subject { super().provider }
65
- it { is_expected.to eq 'Vimeo' }
66
- end
67
-
68
- describe '#playlist_id' do
69
- subject { super().playlist_id }
70
- it { is_expected.to eq '1921098' }
71
- end
72
-
73
- describe '#url' do
74
- subject { super().url }
75
- it { is_expected.to eq 'http://vimeo.com/album/1921098' }
76
- end
77
-
78
- describe '#embed_url' do
79
- subject { super().embed_url }
80
- it { is_expected.to eq '//player.vimeo.com/hubnut/album/1921098' }
81
- end
82
-
83
- describe '#embed_code' do
84
- subject { super().embed_code }
85
- it { is_expected.to eq "<iframe src=\"//player.vimeo.com/hubnut/album/1921098?autoplay=0&byline=0&portrait=0&title=0\" frameborder=\"0\"></iframe>" }
86
- end
87
-
88
- describe '#title' do
89
- subject { super().title }
90
- it { is_expected.to eq 'Get To Know The New Vimeo' }
91
- end
92
-
93
- describe '#description' do
94
- subject { super().description }
95
- it { is_expected.to eq 'Tutorials to get you started in the brand new Vimeo!' }
96
- end
97
-
98
- describe '#keywords' do
99
- subject { super().keywords }
100
- it { is_expected.to be_nil }
101
- end
102
-
103
- describe '#duration' do
104
- subject { super().duration }
105
- it { is_expected.to eq 1254 }
106
- end
107
-
108
- describe '#width' do
109
- subject { super().width }
110
- it { is_expected.to be_nil }
111
- end
112
-
113
- describe '#height' do
114
- subject { super().height }
115
- it { is_expected.to be_nil }
116
- end
117
-
118
- describe '#date' do
119
- subject { super().date }
120
- it { is_expected.to eq Time.parse('2012-04-30T15:00:53+00:00', Time.now.utc).utc }
121
- end
122
-
123
- describe '#thumbnail_small' do
124
- subject { super().thumbnail_small }
125
- it { is_expected.to eq 'https://i.vimeocdn.com/video/299773432_100x75.jpg' }
126
- end
127
-
128
- describe '#thumbnail_medium' do
129
- subject { super().thumbnail_medium }
130
- it { is_expected.to eq 'https://i.vimeocdn.com/video/299773432_200x150.jpg' }
131
- end
132
-
133
- describe '#thumbnail_large' do
134
- subject { super().thumbnail_large }
135
- it { is_expected.to eq 'https://i.vimeocdn.com/video/299773432_640.jpg' }
136
- end
137
-
138
- describe '#videos' do
139
- subject { super().videos }
140
- it { is_expected.to match_array(videos) }
141
- end
142
-
143
- describe '#view_count' do
144
- subject { super().view_count }
145
- it { is_expected.to be_nil }
146
- end
147
- end
148
-
149
- context 'with playlist 2755718 in embed path', :vcr do
150
- subject { VideoInfo.new('http://player.vimeo.com/hubnut/album/2755718') }
151
-
152
- describe '#playlist_id' do
153
- subject { super().playlist_id }
154
- it { is_expected.to eq '2755718' }
155
- end
156
- end
157
- end