SoundDrop
A gem that exposes various track information about a Soundcloud song by providing a URL. This gem is very limited in comparison to the original soundcloud API gem and provides no real advantage other than getting a media download URL.
Installation
Add this line to your application's Gemfile:
gem 'sounddrop'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sounddrop
Usage
Being that we're only considering crude track information, there really is no need to do any sort of user authentication. All you really need is a CLIENT_ID
and CLIENT_SECRET
.
How to get said keys? Easy! Head over to the [Soundcloud developers site] (developers.soundcloud.com) and register your application!
Everything is accessed via a Drop
object which is created using a Client
object.
client = SoundDrop::Client.new(
client_id: CLIENT_ID,
client_secret: CLIENT_SECRET
) #=> SoundDrop::Client
You can also specify :username
and :password
if you'd like.
Now for getting track information:
track_url = 'https://soundcloud.com/armadacaptivating/id-everytime-you-smile'
drop = client.get_drop(track_url) #=> SoundDrop::Drop
Let's get some useful data:
id = drop.id #=> Gets the track id
title = drop.title #=> Gets the track title
genre = drop.genre #=> Gets the track genre
media_url = drop.media_url #=> Gets the track download URL
Contributing
- Fork it ( https://github.com/Alexanderbez/sounddrop/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request