video_info 3.0.1 → 3.0.2

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: 67a6553b4f475bfa408c26ce85d767137fc96929db2408b3d63d4ef001ccf3b7
4
- data.tar.gz: f13ce187227e4e9fb2b85005ff9ee2cb533d6daca85e435051a502c5ebfd8587
3
+ metadata.gz: f960d9a256e4190a6ebde694ff7f73aa630c69e82d2b76d1caed6dca392e27e0
4
+ data.tar.gz: 8b8eae4ca13fd6db5afddc9de44ceb8ae4d7a0ca2508d9da7b5dd80c76b2210a
5
5
  SHA512:
6
- metadata.gz: fdfc18c5585413157163efc32673fe12e25a2a6562be97135cb3c9bd5d0813ac51ed04b1b1607da2ba8c255a4a1bae622466717d0cae5b1bdc10cf16f8c72204
7
- data.tar.gz: e01f5f8358321e0c2e3e777f736341449c2929cabf351f0e5d5a918113635b130c34ec6e1e023689065207094dc147b90c14fb0171fa1e9124eb9bab8bd539b7
6
+ metadata.gz: 3806b4f8e3f44c852c2adda8183fed0cd007d18c67647b59ed702be8ae8aa64e002bb019fbf6f1d54d4d61f0410924dddfca9315a74bb982994f0f8d2392d726
7
+ data.tar.gz: c3b416a326ec07d0c692d35e8dd0be5ef3024368d2f79c41f86e5ac7595259eb16aeb59f78d74a918e8ff5b5d838c160001f1abd1b2d049226b4e6ca727ded50
@@ -1,6 +1,8 @@
1
1
  class VideoInfo
2
2
  module Providers
3
3
  module VimeoAPI
4
+ THUMBNAIL_LINK_REGEX = /.*\/(\d+\-[^_]+)/
5
+
4
6
  def api_key
5
7
  VideoInfo.provider_api_keys[:vimeo]
6
8
  end
@@ -23,7 +25,7 @@ class VideoInfo
23
25
 
24
26
  def author_thumbnail_id
25
27
  author_uri = _video['user']['pictures']['uri']
26
- @author_thumbnail_id ||= _parse_picture_id(author_uri)
28
+ @author_thumbnail_id ||= parse_picture_id_from_user(author_uri)
27
29
  end
28
30
 
29
31
  def author_url
@@ -36,7 +38,7 @@ class VideoInfo
36
38
  end
37
39
 
38
40
  def thumbnail_id
39
- @thumbnail_id ||= _parse_picture_id(_video['pictures']['uri'])
41
+ @thumbnail_id ||= parse_picture_id(_video.dig("pictures", "sizes").first["link"])
40
42
  end
41
43
 
42
44
  def thumbnail_small
@@ -111,9 +113,13 @@ class VideoInfo
111
113
  "https://#{_api_base}#{_api_path}"
112
114
  end
113
115
 
114
- def _parse_picture_id(uri)
116
+ def parse_picture_id_from_user (uri)
115
117
  %r{\/pictures\/(\d+)}.match(uri)[1]
116
118
  end
119
+
120
+ def parse_picture_id(uri)
121
+ uri.match(THUMBNAIL_LINK_REGEX)[1]
122
+ end
117
123
  end
118
124
  end
119
125
  end
@@ -1,3 +1,3 @@
1
1
  class VideoInfo
2
- VERSION = '3.0.1'.freeze
2
+ VERSION = '3.0.2'.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: 3.0.1
4
+ version: 3.0.2
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: 2021-02-17 00:00:00.000000000 Z
11
+ date: 2021-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso8601
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  - !ruby/object:Gem::Version
202
202
  version: '0'
203
203
  requirements: []
204
- rubygems_version: 3.1.4
204
+ rubygems_version: 3.2.22
205
205
  signing_key:
206
206
  specification_version: 4
207
207
  summary: Dailymotion, Vimeo and YouTube info parser.