GithubHelp home page GithubHelp logo

fizvlad / vk-music-rb Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 220 KB

Ruby library to work with popular Russian network audios. VK stands for Very Kool btw

License: MIT License

Ruby 99.89% Shell 0.11%
ruby library gem vk audios music playlist vk-music

vk-music-rb's Introduction

Gem GitHub Workflow Status Lines of code Gem

VkMusic

vk_music gem is a library to work with audios on popular Russian social network

Installation

Add this line to your application's Gemfile:

gem 'vk_music'

And then execute:

$ bundle

Or install it using gem:

$ gem install vk_music

Usage

You can take a look on documentation at rubydoc.

Logging in

Firstly, it is required to create new VkMusic::Client instance and provide login credentials:

client = VkMusic::Client.new(username: "+79991234567", password: "password")

Search

You can search audios using Client#find:

audios = client.find("Acid Spit - Mega Drive")

You can also search for playlists using same method:

playlists = client.find("Jazz", type: :playlist)

Playlists

You can load playlist audios with Client#playlist

playlist = client.playlist(url: "link")

User or group audios

You can load profile audios with Client#audios

playlist = client.audios(owner_id: 8024985)

Wall audios

You can load audios from profile wall with Client#wall

playlist = client.wall(owner_id: 8024985)

Audios from post

You can load up to 10 audios attached to some post. Those audios will be returned as array:

audios = client.post(url: "link")

Artist audios

You can get up to 50 top audios of particular artist:

audios = client.artist(url: "link")

Getting audio URL

To get audio URL you should go through following chain:

  1. Get audio ID
  2. Get audio encrypted URL
  3. Get audio decrypted URL

Usually most of audios already go with ID. Getting encrypted URL requires additional request to web, so it is performed with Client#update_urls, which will mutate provided array of audios:

client.update_urls(audios_array)

After this you can get decrypted URL using Audio#url

Development

Feel free to add features. However, please make sure all your code is covered with tests.

Testing

This gem uses rspec and vcr for easy testing. Be careful, though, running rspec in clean repo may result in lot of requests to web and rate limiting or ban

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/fizvlad/vk-music-rb/issues.

License

The gem is available as open source under the terms of the MIT License.

vk-music-rb's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

vk-music-rb's Issues

Add SOCKS4/5, HTTPS proxy support

Is there a way to download audios using proxy?
For example I want to download audios from several posts:
audios1 = client.post("https://vk.com/wall-4790861_5453")
audios1 = client.post("https://vk.com/wall-4790861_5458")
Can I add parameters for proxy for every post? This way for example:
audios = client.post("https://vk.com/wall-4790861_5453", type: "socks5", url: "192.168.0.3")

Or is it neccessary to specify proxy here?
client = VkMusic::Client.new(username: "+71234567890", password: "password", type: "socks5", url: "192.168.0.3")

P.S. I heard that VK audio urls are linked with clients IP but there is no confirmation that audio url is linked with certain user.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.