- Notifications
You must be signed in to change notification settings - Fork0
Ruby library to work with popular Russian network audios. VK stands for Very Kool btw
License
fizvlad/vk-music-rb
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
vk_music gem is a library to work with audios on popular Russian social network
Add this line to your application's Gemfile:
gem'vk_music'
And then execute:
$ bundle
Or install it usinggem
:
$ gem install vk_music
You can take a look on documentation atrubydoc.
Firstly, it is required to create newVkMusic::Client
instance and provide login credentials:
client=VkMusic::Client.new(username:"+79991234567",password:"password")
You can search audios usingClient#find
:
audios=client.find("Acid Spit - Mega Drive")
You can also search for playlists using same method:
playlists=client.find("Jazz",type::playlist)
You can load playlist audios withClient#playlist
playlist=client.playlist(url:"link")
You can load profile audios withClient#audios
playlist=client.audios(owner_id:8024985)
You can load audios from profile wall withClient#wall
playlist=client.wall(owner_id:8024985)
You can load up to 10 audios attached to some post. Those audios will be returned as array:
audios=client.post(url:"link")
You can get up to 50 top audios of particular artist:
audios=client.artist(url:"link")
To get audio URL you should go through following chain:
- Get audio ID
- Get audio encrypted URL
- Get audio decrypted URL
Usually most of audios already go with ID. Getting encrypted URL requires additional request to web, so it is performed withClient#update_urls
, which will mutate provided array of audios:
client.update_urls(audios_array)
After this you can get decrypted URL usingAudio#url
Feel free to add features. However, please make sure all your code is covered with tests.
This gem usesrspec
andvcr
for easy testing.Be careful, though, runningrspec
in clean repo may result in lot of requests to web and rate limiting or ban
Bug reports and pull requests are welcome on GitHub athttps://github.com/fizvlad/vk-music-rb/issues.
The gem is available as open source under the terms of theMIT License.
About
Ruby library to work with popular Russian network audios. VK stands for Very Kool btw