video_info 4.0.0 → 4.2.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: c8147a3698a183d13edcbf0a4bb084741c99b6c64f69d562ce441f7e116a8d8d
4
+ data.tar.gz: 2b52569e7059929c4c64816f5f204bdd74fd669b775558dc76a8ef8dca693bb1
5
5
  SHA512:
6
- metadata.gz: 91f46cde99f57f21766f648edf87a9b18b8d6ac134ada1fb2f6aa00eebf545e5dee585dbe15113c542c41bcab6f4d8a16dcb4620f3927fc1d1aee5c802601d69
7
- data.tar.gz: 72dac7cb696e34e02c562ff7d58dc997adb574a48bee51071468ff81d8e0d777abc72e8847d24b58f1bdba78b31345c51f0d6f249288a0fab942d43301754f7e
6
+ metadata.gz: bda11c5fc3854079bfe460e3a161dbba6cdd47219004b9a03f05a60448633f81e8712480e933d3812294e52dee5eedb89c44376b2872663853eea8764e9bfda4
7
+ data.tar.gz: 274803d8d83b50659cdae0b6b7f59abf7c20595d07ddedc3627298a8f7b01b0a45bd72f5bfbc7d3b58d25831c9fea408d1eccc5ce7ba0d726badf30ddbcfc1d8
@@ -20,7 +20,7 @@ jobs:
20
20
  strategy:
21
21
  fail-fast: false
22
22
  matrix:
23
- ruby: ['2.7', '3.0', '3.1', '3.2', 'head']
23
+ ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', 'head']
24
24
  steps:
25
25
  - uses: actions/checkout@v3
26
26
  - uses: ruby/setup-ruby@v1
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ # Temporal Ruby 3.4 support, see more: https://github.com/vcr/vcr/pull/1003
6
+ gem 'base64'
data/README.md CHANGED
@@ -6,9 +6,12 @@
6
6
  [![Test Coverage](https://api.codeclimate.com/v1/badges/1f03474bdb81e735002c/test_coverage)](https://codeclimate.com/github/thibaudgg/video_info/test_coverage)
7
7
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
8
8
 
9
- Simple Ruby Gem to get video info from Dailymotion, Vimeo, Wistia and YouTube (with playlist).
9
+ Simple Ruby Gem to get video information from different providers. Supported providers:
10
10
 
11
- Tested against Ruby 2.7, 3.0, 3.1 and 3.2.
11
+ - YouTube (with playlists)
12
+ - Vimeo
13
+ - Dailymotion
14
+ - Wistia
12
15
 
13
16
  ## Features
14
17
 
@@ -24,6 +27,12 @@ Tested against Ruby 2.7, 3.0, 3.1 and 3.2.
24
27
  gem install video_info
25
28
  ```
26
29
 
30
+ Or add to the Gemfile:
31
+
32
+ ```bash
33
+ gem 'video_info'
34
+ ```
35
+
27
36
  ## Usage
28
37
 
29
38
  ### Note for YouTube and Vimeo usage!
@@ -198,4 +207,4 @@ Please read [the contributing guidelines](CONTRIBUTING.md).
198
207
 
199
208
  ### Contributors
200
209
 
201
- [https://github.com/thibaudgg/video_info/graphs/contributors](https://github.com/thibaudgg/video_info/graphs/contributors)
210
+ Thanks to [all contributors](https://github.com/thibaudgg/video_info/graphs/contributors)!
@@ -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
@@ -54,7 +54,7 @@ class VideoInfo
54
54
  private
55
55
 
56
56
  def _url_regex
57
- %r{(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|
57
+ %r{(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?|live|shorts)/|
58
58
  .*[?&]v=)|youtu\.be/)([^"&?/ ]{11})}x
59
59
  end
60
60
 
@@ -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.2.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.2.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: 2024-03-18 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.