vk_music 4.0.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -11
- data/lib/vk_music/client.rb +0 -6
- data/lib/vk_music/utility/audio_data_parser.rb +3 -3
- data/lib/vk_music/utility/audio_items_parser.rb +2 -2
- data/lib/vk_music/utility/audio_node_parser.rb +1 -1
- data/lib/vk_music/utility/audios_from_ids_loader.rb +1 -1
- data/lib/vk_music/utility/audios_ids_getter.rb +1 -1
- data/lib/vk_music/utility/audios_loader.rb +1 -1
- data/lib/vk_music/utility/data_type_guesser.rb +1 -1
- data/lib/vk_music/utility/duration_parser.rb +1 -1
- data/lib/vk_music/utility/last_profile_post_loader.rb +1 -1
- data/lib/vk_music/utility/link_decoder.rb +4 -3
- data/lib/vk_music/utility/node_text_children_reader.rb +2 -2
- data/lib/vk_music/utility/playlist_loader.rb +1 -1
- data/lib/vk_music/utility/playlist_node_parser.rb +1 -1
- data/lib/vk_music/utility/playlist_section_loader.rb +1 -1
- data/lib/vk_music/utility/playlist_url_parser.rb +1 -1
- data/lib/vk_music/utility/post_loader.rb +1 -1
- data/lib/vk_music/utility/post_url_parser.rb +1 -1
- data/lib/vk_music/utility/profile_id_resolver.rb +1 -1
- data/lib/vk_music/utility/wall_loader.rb +1 -1
- data/lib/vk_music/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 982d3964597ca683823d8dfd1aff172ef5f117b740e9020aabf5019cb43beea5
|
4
|
+
data.tar.gz: 6bd53fb80d6105287e0db7e2b6af63c224d5ce366b4e227cbb0d310d49c167ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d15ced8f7a23fdce6ee9304264092b11fceeb93d78f213ff1be8b2e47566c334011b1f8065d88e7125c81df5b4939ca21ee9f986e72f2a13c183edd35c861304
|
7
|
+
data.tar.gz: 39294ec31d752dc92147916a69f2460110fad028ff7115210bbfae19b786707c7dbc9e7cee5f19a3254b668605785cde10c3fde40cc93d1bd80825415da0a4aa
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
vk_music (4.0.
|
4
|
+
vk_music (4.0.2)
|
5
5
|
execjs (~> 2.7)
|
6
6
|
json (~> 2.3)
|
7
7
|
logger (~> 1.4)
|
@@ -26,7 +26,7 @@ GEM
|
|
26
26
|
hashdiff (1.0.1)
|
27
27
|
http-cookie (1.0.3)
|
28
28
|
domain_name (~> 0.5)
|
29
|
-
json (2.
|
29
|
+
json (2.4.1)
|
30
30
|
logger (1.4.2)
|
31
31
|
mechanize (2.7.6)
|
32
32
|
domain_name (~> 0.5, >= 0.5.1)
|
@@ -47,7 +47,7 @@ GEM
|
|
47
47
|
nokogiri (1.10.10)
|
48
48
|
mini_portile2 (~> 2.4.0)
|
49
49
|
ntlm-http (0.1.1)
|
50
|
-
parallel (1.
|
50
|
+
parallel (1.20.1)
|
51
51
|
parser (2.7.2.0)
|
52
52
|
ast (~> 2.4.1)
|
53
53
|
pry (0.13.1)
|
@@ -56,7 +56,7 @@ GEM
|
|
56
56
|
public_suffix (4.0.6)
|
57
57
|
rainbow (3.0.0)
|
58
58
|
rake (13.0.1)
|
59
|
-
regexp_parser (
|
59
|
+
regexp_parser (2.0.0)
|
60
60
|
rexml (3.2.4)
|
61
61
|
rspec (3.10.0)
|
62
62
|
rspec-core (~> 3.10.0)
|
@@ -71,28 +71,30 @@ GEM
|
|
71
71
|
diff-lcs (>= 1.2.0, < 2.0)
|
72
72
|
rspec-support (~> 3.10.0)
|
73
73
|
rspec-support (3.10.0)
|
74
|
-
rubocop (1.
|
74
|
+
rubocop (1.6.1)
|
75
75
|
parallel (~> 1.10)
|
76
76
|
parser (>= 2.7.1.5)
|
77
77
|
rainbow (>= 2.2.2, < 4.0)
|
78
|
-
regexp_parser (>= 1.8)
|
78
|
+
regexp_parser (>= 1.8, < 3.0)
|
79
79
|
rexml
|
80
|
-
rubocop-ast (>= 1.0.
|
80
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
81
81
|
ruby-progressbar (~> 1.7)
|
82
82
|
unicode-display_width (>= 1.4.0, < 2.0)
|
83
|
-
rubocop-ast (1.
|
83
|
+
rubocop-ast (1.3.0)
|
84
84
|
parser (>= 2.7.1.5)
|
85
85
|
ruby-progressbar (1.10.1)
|
86
|
-
simplecov (0.
|
86
|
+
simplecov (0.20.0)
|
87
87
|
docile (~> 1.1)
|
88
88
|
simplecov-html (~> 0.11)
|
89
|
+
simplecov_json_formatter (~> 0.1)
|
89
90
|
simplecov-html (0.12.3)
|
91
|
+
simplecov_json_formatter (0.1.2)
|
90
92
|
unf (0.1.4)
|
91
93
|
unf_ext
|
92
94
|
unf_ext (0.0.7.7)
|
93
95
|
unicode-display_width (1.7.0)
|
94
96
|
vcr (6.0.0)
|
95
|
-
webmock (3.
|
97
|
+
webmock (3.10.0)
|
96
98
|
addressable (>= 2.3.6)
|
97
99
|
crack (>= 0.3.2)
|
98
100
|
hashdiff (>= 0.4.0, < 2.0.0)
|
@@ -101,7 +103,6 @@ GEM
|
|
101
103
|
|
102
104
|
PLATFORMS
|
103
105
|
ruby
|
104
|
-
x64-mingw32
|
105
106
|
|
106
107
|
DEPENDENCIES
|
107
108
|
byebug
|
data/lib/vk_music/client.rb
CHANGED
@@ -3,17 +3,17 @@
|
|
3
3
|
module VkMusic
|
4
4
|
module Utility
|
5
5
|
# Parse {Audio} from +Array+ of audio data
|
6
|
-
|
6
|
+
module AudioDataParser
|
7
7
|
class << self
|
8
8
|
# @param data [Array]
|
9
9
|
# @param client_id [Integer]
|
10
10
|
# @return [Audio]
|
11
11
|
def call(data, client_id)
|
12
12
|
url_encoded = get_url_encoded(data)
|
13
|
-
|
13
|
+
_add_hash, _edit_hash, action_hash, _delete_hash, _teplace_hash, url_hash = get_secrets(data)
|
14
14
|
|
15
15
|
Audio.new(id: data[0], owner_id: data[1],
|
16
|
-
secret1:
|
16
|
+
secret1: action_hash, secret2: url_hash,
|
17
17
|
artist: CGI.unescapeHTML(data[4]), title: CGI.unescapeHTML(data[3]),
|
18
18
|
duration: data[5],
|
19
19
|
url_encoded: url_encoded, url: nil, client_id: client_id)
|
@@ -3,12 +3,12 @@
|
|
3
3
|
module VkMusic
|
4
4
|
module Utility
|
5
5
|
# Parse {Audio} from +Nokogiri::XML::Node+
|
6
|
-
|
6
|
+
module AudioItemsParser
|
7
7
|
# @param node [Nokogiri::XML::Node]
|
8
8
|
# @param client_id [Integer]
|
9
9
|
# @return [Array<Audio>]
|
10
10
|
def self.call(node, client_id)
|
11
|
-
node.css('.audio_item.ai_has_btn').map do |elem|
|
11
|
+
node.css('.audio_item.ai_has_btn,.audio_item.audio_item_disabled').map do |elem|
|
12
12
|
data = JSON.parse(elem.attribute('data-audio').value)
|
13
13
|
Utility::AudioDataParser.call(data, client_id)
|
14
14
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module VkMusic
|
4
4
|
module Utility
|
5
5
|
# Load ids from array of data
|
6
|
-
|
6
|
+
module AudiosIdsGetter
|
7
7
|
# @param args [Array<Audio, (owner_id, audio_id, secret_1, secret_2),
|
8
8
|
# "#{owner_id}_#{id}_#{secret_1}_#{secret_2}">]
|
9
9
|
# @return [Array<String>] array of uniq full ids
|
@@ -6,7 +6,7 @@ require_relative 'post_url_parser'
|
|
6
6
|
module VkMusic
|
7
7
|
module Utility
|
8
8
|
# Guess type of method to use based on string data
|
9
|
-
|
9
|
+
module DataTypeGuesser
|
10
10
|
# End of playlist URL
|
11
11
|
PLAYLIST_POSTFIX = PlaylistUrlParser::VK_PLAYLIST_URL_POSTFIX
|
12
12
|
public_constant :PLAYLIST_POSTFIX
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module VkMusic
|
4
4
|
module Utility
|
5
5
|
# Turn human readable track length to its size in seconds
|
6
|
-
|
6
|
+
module DurationParser
|
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)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module VkMusic
|
4
4
|
module Utility
|
5
5
|
# Link decoding utilities
|
6
|
-
|
6
|
+
module LinkDecoder
|
7
7
|
# JS code which creates function to unmask audio URL.
|
8
8
|
JS_CODE = <<~HEREDOC
|
9
9
|
function vk_unmask_link(link, vk_id) {
|
@@ -96,9 +96,10 @@ module VkMusic
|
|
96
96
|
# @param client_id [Integer] ID of user which got this link. ID is required for decoding.
|
97
97
|
# @return [String?] audio download URL, which can be used only from current IP.
|
98
98
|
def self.call(link, client_id)
|
99
|
+
VkMusic.log.debug('LinkDecoder') { "Unmasking link `#{link}` with client id #{client_id}" }
|
99
100
|
@@js_context.call('vk_unmask_link', link, client_id)
|
100
|
-
rescue StandardError
|
101
|
-
VkMusic.log.warn('LinkDecoder') { "Failed to decode link
|
101
|
+
rescue StandardError => e
|
102
|
+
VkMusic.log.warn('LinkDecoder') { "Failed to decode link `#{link}`: #{e.full_message}" }
|
102
103
|
nil
|
103
104
|
end
|
104
105
|
end
|
@@ -3,11 +3,11 @@
|
|
3
3
|
module VkMusic
|
4
4
|
module Utility
|
5
5
|
# Read inner of text-childrens of +Nokogiri::XML::Node+ node
|
6
|
-
|
6
|
+
module NodeTextChildrenReader
|
7
7
|
# @param node [Nokogiri::XML::Node]
|
8
8
|
# @return [String]
|
9
9
|
def self.call(node)
|
10
|
-
node.children.select(&:text?).map(&:text).join
|
10
|
+
node.children.select(&:text?).map(&:text).join.strip
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
data/lib/vk_music/version.rb
CHANGED
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.0.
|
4
|
+
version: 4.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fizvlad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|