video_info 4.0.0 → 4.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: a38718ee6a56eeea64af973e390986e80592369b3493f9e769316b72f7bd20c3
4
- data.tar.gz: 5d1d36326e69350b53ddfdf9e2473f5538a93453fc5a85d5f1da30238fc1194f
3
+ metadata.gz: b389a80be182106eeba217bf53d64801d78c9e95110e39c136d53af11dd813fe
4
+ data.tar.gz: 6dc99daeaafd264ef991232c85fa5bc6b4c3713d8ef83895e48bc6f27a461d61
5
5
  SHA512:
6
- metadata.gz: 91f46cde99f57f21766f648edf87a9b18b8d6ac134ada1fb2f6aa00eebf545e5dee585dbe15113c542c41bcab6f4d8a16dcb4620f3927fc1d1aee5c802601d69
7
- data.tar.gz: 72dac7cb696e34e02c562ff7d58dc997adb574a48bee51071468ff81d8e0d777abc72e8847d24b58f1bdba78b31345c51f0d6f249288a0fab942d43301754f7e
6
+ metadata.gz: 91095899474824019cc2fa55f128fd20c3fe288aa558de950abc2ea39f2546cdfb68597992e1abad1f6294ea9deb49c190ce8676bcb036cbb2d82ee6177082d6
7
+ data.tar.gz: d0a09d7f75591250157f8d4c2e9996a7072db3f41bf1fed92adf8235066c535147f7c1d4f0b5451aec16673c33635577e2bfb0d5c29cf5a901bcabb51b0abcd7
data/README.md CHANGED
@@ -24,6 +24,12 @@ Tested against Ruby 2.7, 3.0, 3.1 and 3.2.
24
24
  gem install video_info
25
25
  ```
26
26
 
27
+ Or add to the Gemfile:
28
+
29
+ ```bash
30
+ gem 'video_info'
31
+ ```
32
+
27
33
  ## Usage
28
34
 
29
35
  ### Note for YouTube and Vimeo usage!
@@ -15,7 +15,7 @@ class VideoInfo
15
15
  end
16
16
 
17
17
  def self.usable?(url)
18
- url.match?(/(vimeo\.com\/(?!album|hubnut\/album).*)/)
18
+ url.match?(%r{(vimeo\.com/(?!album|hubnut/album|user\d+/?\z).*)})
19
19
  end
20
20
 
21
21
  def provider
@@ -131,9 +131,9 @@ class VideoInfo
131
131
  private
132
132
 
133
133
  def user_interaction_count(interaction_type:)
134
- interaction_statistic.find do |stat|
134
+ interaction_statistic&.find do |stat|
135
135
  stat["interactionType"] == "http://schema.org/#{interaction_type}"
136
- end["userInteractionCount"]
136
+ end&.public_send(:[], "userInteractionCount")
137
137
  end
138
138
 
139
139
  def interaction_statistic
@@ -29,7 +29,11 @@ class VideoInfo
29
29
  end
30
30
 
31
31
  def channel_id
32
- itemprop_node_value("channelId")
32
+ # NOTE the previous implementation, based on itemprop_node_value("channelId"),
33
+ # does not work well, probably due to some YouTube change
34
+ page_content = data.to_s
35
+ matches = page_content.match(/"channelId":"([a-zA-Z0-9_-]+)"/)
36
+ matches[1] if matches
33
37
  end
34
38
 
35
39
  def author_url
@@ -1,3 +1,3 @@
1
1
  class VideoInfo
2
- VERSION = "4.0.0".freeze
2
+ VERSION = "4.1.0".freeze
3
3
  end
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: 4.0.0
4
+ version: 4.1.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: 2023-03-11 00:00:00.000000000 Z
11
+ date: 2023-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso8601
@@ -212,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
212
  - !ruby/object:Gem::Version
213
213
  version: '0'
214
214
  requirements: []
215
- rubygems_version: 3.4.6
215
+ rubygems_version: 3.4.10
216
216
  signing_key:
217
217
  specification_version: 4
218
218
  summary: Dailymotion, Vimeo and YouTube info parser.