video_info 3.0.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f960d9a256e4190a6ebde694ff7f73aa630c69e82d2b76d1caed6dca392e27e0
4
- data.tar.gz: 8b8eae4ca13fd6db5afddc9de44ceb8ae4d7a0ca2508d9da7b5dd80c76b2210a
3
+ metadata.gz: d5bcfd93f9cf4782cb70fdaabbbfeb95b6e054e2403c772fce72834d1f302d81
4
+ data.tar.gz: 99614494315f07c9049b67a30ceb7410882b860030faa3290e0eab9ea1711938
5
5
  SHA512:
6
- metadata.gz: 3806b4f8e3f44c852c2adda8183fed0cd007d18c67647b59ed702be8ae8aa64e002bb019fbf6f1d54d4d61f0410924dddfca9315a74bb982994f0f8d2392d726
7
- data.tar.gz: c3b416a326ec07d0c692d35e8dd0be5ef3024368d2f79c41f86e5ac7595259eb16aeb59f78d74a918e8ff5b5d838c160001f1abd1b2d049226b4e6ca727ded50
6
+ metadata.gz: dd789c89161544b5c10cca61e87f9ca1cb4ce42741bda74f22ccc0ffd47d3715c6954ce6b8581c23e3aa13f92f3d42ed3eea9053aca807a8415a74b41f2d0b43
7
+ data.tar.gz: a52184b867d403f45f703092a82b2ac9f1b059773cc9efbb596ebf3ede90707c10ceed9e1d58385b28ad8d46cf07a7ea47f90972d0d0bfa454e6053a991a09ba
data/README.md CHANGED
@@ -124,6 +124,17 @@ playlist = VideoInfo.new("http://www.youtube.com/playlist?p=PL9hW1uS6HUftLdHI6RI
124
124
  # playlist.videos => [VideoInfo.new('http://www.youtube.com/watch?v=_Bt3-WsHfB0'), VideoInfo.new('http://www.youtube.com/watch?v=9g2U12SsRns'), VideoInfo.new('http://www.youtube.com/watch?v=8b0aEoxqqC0'), VideoInfo.new('http://www.youtube.com/watch?v=6c3mHikRz0I'), VideoInfo.new('http://www.youtube.com/watch?v=OQVHWsTHcoc')]
125
125
  ```
126
126
 
127
+ You can also use the `valid_url?` helper to check if a given url is valid in some of the _enabled_ providers:
128
+
129
+ ```ruby
130
+ > VideoInfo.valid_url?('http://www.youtube.com/watch?v=AT_5xOGh6Ko')
131
+ => true
132
+ > VideoInfo.valid_url?('http://vimeo.com/898029')
133
+ => true
134
+ > VideoInfo.valid_url?('http://www.example.com/video/12345')
135
+ => false
136
+ ```
137
+
127
138
  Options
128
139
  -------
129
140
 
@@ -1,3 +1,3 @@
1
1
  class VideoInfo
2
- VERSION = '3.0.2'.freeze
2
+ VERSION = '3.1.0'.freeze
3
3
  end
data/lib/video_info.rb CHANGED
@@ -81,6 +81,16 @@ class VideoInfo
81
81
  disable_providers.map(&:downcase).include?(provider.downcase)
82
82
  end
83
83
 
84
+ def self.enabled_providers
85
+ PROVIDERS
86
+ .reject { |p| disabled_provider?(p) }
87
+ .map { |p| Providers.const_get(p) }
88
+ end
89
+
90
+ def self.valid_url?(url)
91
+ enabled_providers.any? { |p| p.usable?(url) }
92
+ end
93
+
84
94
  private
85
95
 
86
96
  def _select_provider(url, options)
data/video_info.gemspec CHANGED
@@ -23,8 +23,8 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency 'oga', '~> 3.0'
24
24
  s.add_dependency 'net_http_timeout_errors', '~> 0.3.0'
25
25
 
26
- s.add_development_dependency 'bundler', '>= 1.3.5'
27
- s.add_development_dependency 'rake', '>= 12.3.3'
26
+ s.add_development_dependency 'bundler', '~> 2.3'
27
+ s.add_development_dependency 'rake', '~> 13.0'
28
28
  s.add_development_dependency 'rspec', '~> 3.4'
29
29
  s.add_development_dependency 'rspec-its', '~> 1.2'
30
30
  s.add_development_dependency 'rubocop', '~> 0.37'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: video_info
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibaud Guillaume-Gentil
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-15 00:00:00.000000000 Z
11
+ date: 2023-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso8601
@@ -56,30 +56,30 @@ dependencies:
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.3.5
61
+ version: '2.3'
62
62
  type: :development
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: 1.3.5
68
+ version: '2.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 12.3.3
75
+ version: '13.0'
76
76
  type: :development
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: 12.3.3
82
+ version: '13.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -186,7 +186,7 @@ homepage: https://rubygems.org/gems/video_info
186
186
  licenses:
187
187
  - MIT
188
188
  metadata: {}
189
- post_install_message:
189
+ post_install_message:
190
190
  rdoc_options: []
191
191
  require_paths:
192
192
  - lib
@@ -201,8 +201,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  - !ruby/object:Gem::Version
202
202
  version: '0'
203
203
  requirements: []
204
- rubygems_version: 3.2.22
205
- signing_key:
204
+ rubygems_version: 3.1.6
205
+ signing_key:
206
206
  specification_version: 4
207
207
  summary: Dailymotion, Vimeo and YouTube info parser.
208
208
  test_files: []