vk_music 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/vk_music/client.rb +3 -1
- data/lib/vk_music/constants.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: 79ce8368cee1e94e3f1351753ba42167f2310148d22c96d274fa0056cda2e06d
|
4
|
+
data.tar.gz: ff35c242aaf9eecdc529eb478346a6e7883d1eb437d7f4fe163d36ebc893092a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c08525601176055fb0c94f666f28a654cea22f196db413d4e9bd0a425e716bcc1752e1f4f9e6de87772d105db41629aa5bb149de5b8cfaa42f020f57038a4d4a
|
7
|
+
data.tar.gz: 7ccd31000b153925a63b69c6d796bfa9d58adf2c8b2fc1ed86c99024f913590bfcba32bb29b27c89c61cb630d6a540f55a4417051d8145601c2d7a5e732e4d9c
|
data/Gemfile.lock
CHANGED
data/lib/vk_music/client.rb
CHANGED
@@ -32,6 +32,7 @@ module VkMusic
|
|
32
32
|
#
|
33
33
|
# @option options [String] :username usually telephone number or email.
|
34
34
|
# @option options [String] :password
|
35
|
+
# @option options [String] :user_agent (Constants::DEFAULT_USER_AGENT)
|
35
36
|
def initialize(options = {})
|
36
37
|
# Arguments check
|
37
38
|
raise ArgumentError, "Options hash must be provided", caller unless options.class == Hash
|
@@ -40,6 +41,7 @@ module VkMusic
|
|
40
41
|
|
41
42
|
# Setting up client
|
42
43
|
@agent = Mechanize.new
|
44
|
+
@agent.user_agent = options[:user_agent] || Constants::DEFAULT_USER_AGENT
|
43
45
|
login(options[:username], options[:password])
|
44
46
|
end
|
45
47
|
|
@@ -704,7 +706,7 @@ module VkMusic
|
|
704
706
|
def login(username, password)
|
705
707
|
Utility.debug("Logging in.")
|
706
708
|
# Loading login page
|
707
|
-
homepage = load__page(Constants::URL::VK[:
|
709
|
+
homepage = load__page(Constants::URL::VK[:login])
|
708
710
|
# Submitting login form
|
709
711
|
login_form = homepage.forms.find { |form| form.action.start_with?(Constants::URL::VK[:login_action]) }
|
710
712
|
login_form[Constants::VK_LOGIN_FORM_NAMES[:username]] = username.to_s
|
data/lib/vk_music/constants.rb
CHANGED
@@ -6,7 +6,7 @@ module VkMusic
|
|
6
6
|
|
7
7
|
##
|
8
8
|
# Web user agent.
|
9
|
-
|
9
|
+
DEFAULT_USER_AGENT = "Mozilla/5.0 (Linux; Android 5.1.1; Redmi 3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Mobile Safari/537.36 OPR/54.2.2672.49907"
|
10
10
|
|
11
11
|
##
|
12
12
|
# Different URLs
|
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: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fizvlad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|