vk_music 4.1.0 → 4.1.4

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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.env.example +0 -0
  3. data/.github/workflows/ruby.yml +0 -0
  4. data/.gitignore +0 -0
  5. data/.rspec +0 -0
  6. data/.rubocop.yml +8 -0
  7. data/.ruby-version +1 -0
  8. data/Gemfile +13 -12
  9. data/Gemfile.lock +59 -55
  10. data/LICENSE.txt +0 -0
  11. data/README.md +0 -0
  12. data/Rakefile +16 -0
  13. data/lib/vk_music/audio.rb +0 -0
  14. data/lib/vk_music/client.rb +0 -0
  15. data/lib/vk_music/playlist.rb +0 -0
  16. data/lib/vk_music/request/artist.rb +0 -0
  17. data/lib/vk_music/request/audios_reload.rb +0 -0
  18. data/lib/vk_music/request/base.rb +0 -0
  19. data/lib/vk_music/request/login.rb +0 -0
  20. data/lib/vk_music/request/my_page.rb +0 -0
  21. data/lib/vk_music/request/playlist.rb +0 -0
  22. data/lib/vk_music/request/playlist_section.rb +0 -0
  23. data/lib/vk_music/request/post.rb +0 -0
  24. data/lib/vk_music/request/profile.rb +0 -0
  25. data/lib/vk_music/request/search.rb +0 -0
  26. data/lib/vk_music/request/wall_section.rb +0 -0
  27. data/lib/vk_music/request.rb +0 -0
  28. data/lib/vk_music/utility/artist_loader.rb +0 -0
  29. data/lib/vk_music/utility/artist_url_parser.rb +0 -0
  30. data/lib/vk_music/utility/audio_data_parser.rb +0 -0
  31. data/lib/vk_music/utility/audio_items_parser.rb +0 -0
  32. data/lib/vk_music/utility/audio_node_parser.rb +0 -0
  33. data/lib/vk_music/utility/audios_from_ids_loader.rb +0 -0
  34. data/lib/vk_music/utility/audios_ids_getter.rb +0 -0
  35. data/lib/vk_music/utility/audios_loader.rb +0 -0
  36. data/lib/vk_music/utility/data_type_guesser.rb +1 -0
  37. data/lib/vk_music/utility/duration_parser.rb +6 -4
  38. data/lib/vk_music/utility/last_profile_post_loader.rb +0 -0
  39. data/lib/vk_music/utility/link_decoder.rb +0 -0
  40. data/lib/vk_music/utility/node_text_children_reader.rb +0 -0
  41. data/lib/vk_music/utility/playlist_loader.rb +0 -0
  42. data/lib/vk_music/utility/playlist_node_parser.rb +0 -0
  43. data/lib/vk_music/utility/playlist_section_loader.rb +0 -0
  44. data/lib/vk_music/utility/playlist_url_parser.rb +0 -0
  45. data/lib/vk_music/utility/post_loader.rb +3 -1
  46. data/lib/vk_music/utility/post_url_parser.rb +0 -0
  47. data/lib/vk_music/utility/profile_id_resolver.rb +0 -0
  48. data/lib/vk_music/utility/wall_loader.rb +0 -0
  49. data/lib/vk_music/utility.rb +0 -0
  50. data/lib/vk_music/version.rb +1 -1
  51. data/lib/vk_music/web_parser/artist.rb +0 -0
  52. data/lib/vk_music/web_parser/audios_reload.rb +0 -0
  53. data/lib/vk_music/web_parser/base.rb +0 -0
  54. data/lib/vk_music/web_parser/login.rb +0 -0
  55. data/lib/vk_music/web_parser/my_page.rb +0 -0
  56. data/lib/vk_music/web_parser/playlist.rb +0 -0
  57. data/lib/vk_music/web_parser/playlist_section.rb +0 -0
  58. data/lib/vk_music/web_parser/post.rb +0 -0
  59. data/lib/vk_music/web_parser/profile.rb +5 -1
  60. data/lib/vk_music/web_parser/search.rb +0 -0
  61. data/lib/vk_music/web_parser/wall_section.rb +0 -0
  62. data/lib/vk_music/web_parser.rb +0 -0
  63. data/lib/vk_music.rb +0 -0
  64. data/vk_music.gemspec +0 -0
  65. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 175777250336a247babea9660fef9e8b2dd070afb304bf4943f5a5f5706d4961
4
- data.tar.gz: fb2421372d37fefc25dadb6823f06c4c7cb4b55cf961830dc3738435a0a758af
3
+ metadata.gz: da1ad67eac04f82ada772151b2321b7eb598321f788d66d12b84e8d2f0475919
4
+ data.tar.gz: 6b8fd6e4ce0eacfdbcd94396dfe9fc56db2cff502188904dd2f991eabb33acc4
5
5
  SHA512:
6
- metadata.gz: a3aa8fe59c41de35155c0111cf2ff54cd3bcbc101490a2ae614ac54920773f3bed658a197f2bce829f95634475c0698272f3efbf806c5f0c422b08a33d5ef607
7
- data.tar.gz: a3e462914a5123ed99aa9eb23f0e13b011b9dd7593a4046c139d0d399ff33a9051efb09def9d6940545ab293c6e7e1e6a798d78b4976b7359b7f3f7aafae5b10
6
+ metadata.gz: 434e1461c9827ffaaeff46ef0f68d63495723947da530014a1da69d242c8601580c50325bfd6d245290e2420bb597196cc20198c1d9e03b754079ef316a46bfe
7
+ data.tar.gz: 87b875c18246bfffe3ab2d54f22bde6a56c3156d4abb5173dad174fe9d91d46513a66a754833cee40fea9df85f852f66ef8fc527fba8368a6ce6667026db28af
data/.env.example CHANGED
File without changes
File without changes
data/.gitignore CHANGED
File without changes
data/.rspec CHANGED
File without changes
data/.rubocop.yml CHANGED
@@ -54,3 +54,11 @@ Style/DisableCopsWithinSourceCodeDirective:
54
54
  Enabled: false
55
55
  Layout/MultilineHashKeyLineBreaks:
56
56
  Enabled: false
57
+ Layout/SingleLineBlockChain:
58
+ Exclude:
59
+ - 'spec/**/*_spec.rb'
60
+ Style/TopLevelMethodDefinition:
61
+ Exclude:
62
+ - 'spec/login_helper.rb'
63
+ Lint/NumberConversion:
64
+ Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.7.2
data/Gemfile CHANGED
@@ -6,33 +6,34 @@ source 'https://rubygems.org'
6
6
  gemspec
7
7
 
8
8
  group :test, :development do
9
- # Debugging console
10
- gem 'pry'
11
-
12
9
  # Another debugging console
13
- gem 'byebug'
10
+ gem 'byebug', '~> 11.1'
14
11
 
15
12
  # The thing, forcing you to write good code
16
- gem 'rubocop', require: false
13
+ gem 'rubocop', '~> 1.21', require: false
14
+ # Guidelines for writing RSpec tests
15
+ gem 'rubocop-rspec', '~> 2.4', require: false
16
+ # Guidelines for Rake tasks
17
+ gem 'rubocop-rake', '~> 0.6', require: false
17
18
 
18
19
  # Rake tasks
19
- gem 'rake', require: false
20
+ gem 'rake', '~> 13.0', require: false
20
21
 
21
22
  # Testing
22
- gem 'rspec', require: false
23
+ gem 'rspec', '~> 3.10', require: false
23
24
 
24
25
  # Docs
25
- gem 'yard', require: false
26
+ gem 'yard', '~> 0.9', require: false
26
27
 
27
28
  # .env support
28
- gem 'dotenv'
29
+ gem 'dotenv', '~> 2.7'
29
30
 
30
31
  # Save web requests for fast and reliable testing
31
- gem 'vcr'
32
+ gem 'vcr', '~> 6.0'
32
33
 
33
34
  # Stub web requests
34
- gem 'webmock'
35
+ gem 'webmock', '~> 3.14'
35
36
 
36
37
  # Test coverage
37
- gem 'simplecov', require: false, group: :test
38
+ gem 'simplecov', '~> 0.21', require: false, group: :test
38
39
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vk_music (4.1.0)
4
+ vk_music (4.1.4)
5
5
  execjs (~> 2.7)
6
6
  json (~> 2.3)
7
7
  logger (~> 1.4)
@@ -11,56 +11,52 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- addressable (2.7.0)
14
+ addressable (2.8.0)
15
15
  public_suffix (>= 2.0.2, < 5.0)
16
- ast (2.4.1)
16
+ ast (2.4.2)
17
17
  byebug (11.1.3)
18
- coderay (1.1.3)
19
18
  crack (0.4.5)
20
19
  rexml
21
20
  diff-lcs (1.4.4)
22
- docile (1.3.4)
21
+ docile (1.4.0)
23
22
  domain_name (0.5.20190701)
24
23
  unf (>= 0.0.5, < 1.0.0)
25
24
  dotenv (2.7.6)
26
- execjs (2.7.0)
25
+ execjs (2.8.1)
27
26
  hashdiff (1.0.1)
28
- http-cookie (1.0.3)
27
+ http-cookie (1.0.4)
29
28
  domain_name (~> 0.5)
30
29
  json (2.5.1)
31
30
  logger (1.4.3)
32
- mechanize (2.7.6)
33
- domain_name (~> 0.5, >= 0.5.1)
34
- http-cookie (~> 1.0)
35
- mime-types (>= 1.17.2)
36
- net-http-digest_auth (~> 1.1, >= 1.1.1)
37
- net-http-persistent (>= 2.5.2)
38
- nokogiri (~> 1.6)
39
- ntlm-http (~> 0.1, >= 0.1.1)
40
- webrobots (>= 0.0.9, < 0.2)
41
- method_source (1.0.0)
31
+ mechanize (2.8.2)
32
+ addressable (~> 2.8)
33
+ domain_name (~> 0.5, >= 0.5.20190701)
34
+ http-cookie (~> 1.0, >= 1.0.3)
35
+ mime-types (~> 3.0)
36
+ net-http-digest_auth (~> 1.4, >= 1.4.1)
37
+ net-http-persistent (>= 2.5.2, < 5.0.dev)
38
+ nokogiri (~> 1.11, >= 1.11.2)
39
+ rubyntlm (~> 0.6, >= 0.6.3)
40
+ webrick (~> 1.7)
41
+ webrobots (~> 0.1.2)
42
42
  mime-types (3.3.1)
43
43
  mime-types-data (~> 3.2015)
44
- mime-types-data (3.2020.1104)
45
- mini_portile2 (2.5.0)
44
+ mime-types-data (3.2021.0901)
45
+ mini_portile2 (2.6.1)
46
46
  net-http-digest_auth (1.4.1)
47
47
  net-http-persistent (2.9.4)
48
- nokogiri (1.11.0)
49
- mini_portile2 (~> 2.5.0)
48
+ nokogiri (1.12.4)
49
+ mini_portile2 (~> 2.6.1)
50
50
  racc (~> 1.4)
51
- ntlm-http (0.1.1)
52
- parallel (1.20.1)
53
- parser (3.0.0.0)
51
+ parallel (1.21.0)
52
+ parser (3.0.2.0)
54
53
  ast (~> 2.4.1)
55
- pry (0.13.1)
56
- coderay (~> 1.1)
57
- method_source (~> 1.0)
58
54
  public_suffix (4.0.6)
59
55
  racc (1.5.2)
60
56
  rainbow (3.0.0)
61
- rake (13.0.3)
62
- regexp_parser (2.0.3)
63
- rexml (3.2.4)
57
+ rake (13.0.6)
58
+ regexp_parser (2.1.1)
59
+ rexml (3.2.5)
64
60
  rspec (3.10.0)
65
61
  rspec-core (~> 3.10.0)
66
62
  rspec-expectations (~> 3.10.0)
@@ -70,37 +66,44 @@ GEM
70
66
  rspec-expectations (3.10.1)
71
67
  diff-lcs (>= 1.2.0, < 2.0)
72
68
  rspec-support (~> 3.10.0)
73
- rspec-mocks (3.10.1)
69
+ rspec-mocks (3.10.2)
74
70
  diff-lcs (>= 1.2.0, < 2.0)
75
71
  rspec-support (~> 3.10.0)
76
- rspec-support (3.10.1)
77
- rubocop (1.7.0)
72
+ rspec-support (3.10.2)
73
+ rubocop (1.21.0)
78
74
  parallel (~> 1.10)
79
- parser (>= 2.7.1.5)
75
+ parser (>= 3.0.0.0)
80
76
  rainbow (>= 2.2.2, < 4.0)
81
77
  regexp_parser (>= 1.8, < 3.0)
82
78
  rexml
83
- rubocop-ast (>= 1.2.0, < 2.0)
79
+ rubocop-ast (>= 1.9.1, < 2.0)
84
80
  ruby-progressbar (~> 1.7)
85
- unicode-display_width (>= 1.4.0, < 2.0)
86
- rubocop-ast (1.4.0)
87
- parser (>= 2.7.1.5)
81
+ unicode-display_width (>= 1.4.0, < 3.0)
82
+ rubocop-ast (1.11.0)
83
+ parser (>= 3.0.1.1)
84
+ rubocop-rake (0.6.0)
85
+ rubocop (~> 1.0)
86
+ rubocop-rspec (2.4.0)
87
+ rubocop (~> 1.0)
88
+ rubocop-ast (>= 1.1.0)
88
89
  ruby-progressbar (1.11.0)
89
- simplecov (0.21.1)
90
+ rubyntlm (0.6.3)
91
+ simplecov (0.21.2)
90
92
  docile (~> 1.1)
91
93
  simplecov-html (~> 0.11)
92
94
  simplecov_json_formatter (~> 0.1)
93
95
  simplecov-html (0.12.3)
94
- simplecov_json_formatter (0.1.2)
96
+ simplecov_json_formatter (0.1.3)
95
97
  unf (0.1.4)
96
98
  unf_ext
97
- unf_ext (0.0.7.7)
98
- unicode-display_width (1.7.0)
99
+ unf_ext (0.0.8)
100
+ unicode-display_width (2.1.0)
99
101
  vcr (6.0.0)
100
- webmock (3.11.0)
101
- addressable (>= 2.3.6)
102
+ webmock (3.14.0)
103
+ addressable (>= 2.8.0)
102
104
  crack (>= 0.3.2)
103
105
  hashdiff (>= 0.4.0, < 2.0.0)
106
+ webrick (1.7.0)
104
107
  webrobots (0.1.2)
105
108
  yard (0.9.26)
106
109
 
@@ -108,17 +111,18 @@ PLATFORMS
108
111
  ruby
109
112
 
110
113
  DEPENDENCIES
111
- byebug
112
- dotenv
113
- pry
114
- rake
115
- rspec
116
- rubocop
117
- simplecov
118
- vcr
114
+ byebug (~> 11.1)
115
+ dotenv (~> 2.7)
116
+ rake (~> 13.0)
117
+ rspec (~> 3.10)
118
+ rubocop (~> 1.21)
119
+ rubocop-rake (~> 0.6)
120
+ rubocop-rspec (~> 2.4)
121
+ simplecov (~> 0.21)
122
+ vcr (~> 6.0)
119
123
  vk_music!
120
- webmock
121
- yard
124
+ webmock (~> 3.14)
125
+ yard (~> 0.9)
122
126
 
123
127
  BUNDLED WITH
124
- 2.1.4
128
+ 2.2.4
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
@@ -16,3 +16,19 @@ YARD::Rake::YardocTask.new do |t|
16
16
  end
17
17
 
18
18
  task default: %i[rubocop spec yard]
19
+
20
+ namespace :clean do
21
+ desc 'Remove generated cassettes'
22
+ task :cassetes do
23
+ require 'fileutils'
24
+
25
+ FileUtils.rm_r Dir.glob('spec/cassetes/*/')
26
+ end
27
+
28
+ desc 'Remove generated cookies'
29
+ task :cookies do
30
+ require 'fileutils'
31
+
32
+ FileUtils.rm('spec/.cookies')
33
+ end
34
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'playlist_url_parser'
4
+ require_relative 'artist_url_parser'
4
5
  require_relative 'post_url_parser'
5
6
 
6
7
  module VkMusic
@@ -7,10 +7,12 @@ module VkMusic
7
7
  # @param str [String] string in format "HH:MM:SS" or something alike (+/d++ Regex selector is used)
8
8
  # @return [Integer] amount of seconds
9
9
  def self.call(str)
10
- str.scan(/\d+/)
11
- .map(&:to_i)
12
- .reverse
13
- .each_with_index.reduce(0) { |acc, (count, position)| acc + count * 60**position }
10
+ str
11
+ .scan(/\d+/)
12
+ .map { |i| Integer(i, 10) }
13
+ .reverse
14
+ .each_with_index
15
+ .reduce(0) { |acc, (count, position)| acc + (count * (60**position)) }
14
16
  end
15
17
  end
16
18
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -16,7 +16,9 @@ module VkMusic
16
16
 
17
17
  wall_audios = WallLoader.call(agent, client_id, owner_id, post_id).audios
18
18
 
19
- urlles_audios.map { |urlles| wall_audios.find { |audio| audio.like?(urlles) } }.compact
19
+ urlles_audios
20
+ .map { |urlles| wall_audios.find { |audio| audio.like?(urlles) } }
21
+ .compact
20
22
  end
21
23
  end
22
24
  end
File without changes
File without changes
File without changes
File without changes
@@ -2,6 +2,6 @@
2
2
 
3
3
  module VkMusic
4
4
  # Library version.
5
- VERSION = '4.1.0'
5
+ VERSION = '4.1.4'
6
6
  public_constant :VERSION
7
7
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -12,9 +12,13 @@ module VkMusic
12
12
  POST_ANCHOR_NAME_REGEX = /post(-?\d+)_(\d+)/.freeze
13
13
  private_constant :POST_ANCHOR_NAME_REGEX
14
14
 
15
+ # CSS selector for link in basis
16
+ BASIS_LINK_SELECTOR = '.basisProfile a,.basisGroup a,.BasisProfile a,.BasisGroup a'
17
+ private_constant :BASIS_LINK_SELECTOR
18
+
15
19
  # Profile id
16
20
  def id
17
- link = node.link_with(href: ID_CONTAINING_HREF, css: '.basisProfile a,.basisGroup a')
21
+ link = node.link_with(href: ID_CONTAINING_HREF, css: BASIS_LINK_SELECTOR)
18
22
  return unless link
19
23
 
20
24
  Integer(link.href.match(ID_CONTAINING_HREF).captures.first, 10)
File without changes
File without changes
File without changes
data/lib/vk_music.rb CHANGED
File without changes
data/vk_music.gemspec CHANGED
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vk_music
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fizvlad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-05 00:00:00.000000000 Z
11
+ date: 2021-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execjs
@@ -92,6 +92,7 @@ files:
92
92
  - ".gitignore"
93
93
  - ".rspec"
94
94
  - ".rubocop.yml"
95
+ - ".ruby-version"
95
96
  - Gemfile
96
97
  - Gemfile.lock
97
98
  - LICENSE.txt
@@ -172,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
173
  - !ruby/object:Gem::Version
173
174
  version: '0'
174
175
  requirements: []
175
- rubygems_version: 3.2.3
176
+ rubygems_version: 3.1.4
176
177
  signing_key:
177
178
  specification_version: 4
178
179
  summary: A library to work with audios on popular Russian social network