vk_music 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +56 -0
- data/vk_music.gemspec +4 -3
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 630c70ebe99cfb32de3d536247332448eba5100ed50e22b625942dd0bfae1ad1
|
4
|
+
data.tar.gz: 449db24fadc1762ebe302a7cd67ac302495b2d05987df3bcbaf105bf6a242ce4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa5706ff7955649611171b4b7fa6fdfabaad1b58c64b8fb2d4a2f594e83b5472d57f989377a4814517f489238e04fe7c2801a4b941e01edd945967256041b424
|
7
|
+
data.tar.gz: 39efc44662fb545306547b83e234b7804fc48d9079c84d0eca6d4276fa4a705ef83f2a6c348a42055c70c4c1ea42d789562d9f8e182bbee6bee092d099246f03
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# vk_music
|
2
|
+
|
3
|
+
*vk_music* gem is a library to work with audios on popular Russian social network [vk.com](https://www.vk.com "vk.com"). VK disabled their public API for audios, so it is now necessary to use parsers instead.
|
4
|
+
|
5
|
+
|
6
|
+
## Dependencies
|
7
|
+
|
8
|
+
* [mechanize](https://github.com/sparklemotion/mechanize "mechanize") (interaction with website)
|
9
|
+
* [duktape](https://github.com/judofyr/duktape.rb "duktape") (JS interpreter)
|
10
|
+
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Simpliest way to install gem:
|
15
|
+
``
|
16
|
+
gem install vk_music
|
17
|
+
``
|
18
|
+
|
19
|
+
Alternatively, you can build gem from sources with following command:
|
20
|
+
``
|
21
|
+
gem build vk_music.gemspec
|
22
|
+
``
|
23
|
+
|
24
|
+
... and install it:
|
25
|
+
``
|
26
|
+
gem install vk_music-0.0.1.gem
|
27
|
+
``
|
28
|
+
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
### Logging in
|
33
|
+
Firstly, it is required to create new *VkMusic::Client* and provide login credentials:
|
34
|
+
```
|
35
|
+
client = VkMusic::Client.new(username: "+71234567890", password: "password")
|
36
|
+
```
|
37
|
+
|
38
|
+
### Searching for audios
|
39
|
+
You can search audios by name with following method:
|
40
|
+
```
|
41
|
+
audios = client.find_audio("Acid Spit - Mega Drive")
|
42
|
+
puts audios[0] # Basic information about audio
|
43
|
+
puts audios[0].url # Download this audio using its URL
|
44
|
+
```
|
45
|
+
|
46
|
+
### Parsing playlists
|
47
|
+
You can load all the audios from playlist using following method:
|
48
|
+
```
|
49
|
+
playlist = client.get_playlist("https://vk.com/audio?z=audio_playlist-37661843_1/0e420c32c8b69e6637")
|
50
|
+
```
|
51
|
+
It is only possible to load up to 100 audios from playlist per request, so you can reduce amount of requests by setting up how many audios from playlist you actually need.
|
52
|
+
For example, following method will perform only one HTML request:
|
53
|
+
```
|
54
|
+
playlist = client.get_playlist("https://vk.com/audio?z=audio_playlist121570739_7", 100)
|
55
|
+
urls = playlist.map(&:url) # URLs for every audio
|
56
|
+
```
|
data/vk_music.gemspec
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "vk_music"
|
3
3
|
s.summary = "Provides interface to work with VK music via HTTP requests"
|
4
|
-
s.
|
5
|
-
s.
|
4
|
+
s.description = "Library to work with audios on popular Russian social network vk.com. VK disabled their public API for audios, so it is now necessary to use parsers instead."
|
5
|
+
s.version = "0.0.2"
|
6
|
+
s.author = "Kuznetsov Vladislav"
|
6
7
|
s.email = "fizvlad@mail.ru"
|
7
8
|
s.homepage = "https://github.com/fizvlad/vk-music-rb"
|
8
9
|
s.platform = Gem::Platform::RUBY
|
9
10
|
s.required_ruby_version = ">=2.5.1"
|
10
|
-
s.files = Dir[ "lib/**/**", "test/**/**", "LICENSE", "Rakefile", "README", "vk_music.gemspec" ]
|
11
|
+
s.files = Dir[ "lib/**/**", "test/**/**", "LICENSE", "Rakefile", "README.md", "vk_music.gemspec" ]
|
11
12
|
s.test_files = Dir[ "test/test*.rb" ]
|
12
13
|
s.has_rdoc = false
|
13
14
|
s.license = "MIT"
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vk_music
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Kuznetsov Vladislav
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
@@ -38,13 +38,15 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.3'
|
41
|
-
description:
|
41
|
+
description: Library to work with audios on popular Russian social network vk.com.
|
42
|
+
VK disabled their public API for audios, so it is now necessary to use parsers instead.
|
42
43
|
email: fizvlad@mail.ru
|
43
44
|
executables: []
|
44
45
|
extensions: []
|
45
46
|
extra_rdoc_files: []
|
46
47
|
files:
|
47
48
|
- LICENSE
|
49
|
+
- README.md
|
48
50
|
- Rakefile
|
49
51
|
- lib/vk_music.rb
|
50
52
|
- lib/vk_music/audio.rb
|