soundcloud-v2-api

Promise-based Javascript Soundcloud v2 API controller.

Stars
7
Committers
1

Soundcloud v2 API Controller

This API controller was created for personal implementation in my project called Soundify. Soundcloud does not currently provide a method for interacting with the new v2 API effectively. The v1 API is missing a lot of endpoints the v2 api has. (/charts to name one).

Navigation

Installation

via NPM

npm i soundcloud-v2-api

via YARN

yarn add soundcloud-v2-api

Usage

Example (Searching Tracks)

const SC = require('soundcloud-v2-api');

SC.init({
 clientId: 'YOUR_CLIENT_ID'
})

SC.get('/search/tracks', {
 q: 'Post', 
 limit: 50
}).then(result => console.log(result))

Example (Streaming Tracks)

//Initialize as in previous example.

SC.stream('/tracks/${track.id}/streams').then(stream => {
 stream.play()
})

Usage in browsers

SC.init({
 clientId: 'YOUR_CLIENT_ID',
 cors: true
})

API Reference

Here are some of the most common endpoints available to use.

/search/:type

Types Returns
tracks List of tracks containing query
users List of users containing query
albums List of albums containing query
playlists List of playlists containing query

/tracks/${track.id}/:type

Types Returns
/ Tracks statistics and information
reposters List of users that reposted the track
likers List of users that liked the track
comments List of comments on the track