Node.js module for the SoundCloud API. See full API documentation here.
In order to use the module, you need to acquire a client_id
for your application, which can be obtained from SoundCloud for Developers page.
This library can be installed through npm:
$ npm install --save soundcloud-api-client
The following example shows how to initialize the library and perform a search request with sample criteria.
const SoundCloud = require('soundcloud-api-client');
const client_id = 'your-client-id';
const soundcloud = new SoundCloud({ client_id });
const q = 'live mix';
const genres = [ 'house', 'tech-house', 'techno' ].join(',');
soundcloud.get('/tracks', { q, genres })
.then(tracks => /* process tracks */)
.catch(e => /* handle error */);
The next example demonstrates how to fetch 10 most recent user comments.
const user = 'user-name-or-id'; // user id is necessary to fetch user tracks
const offset = 0;
const limit = 10;
soundcloud.get(`/users/${user}/comments`, { offset, limit })
.then(comments => /* process comments */)
.catch(e => /* handle error */);
The main export of this library is the SoundCloud class.
The SoundCloud constructor accepts a config
object which may contain one or more of the following options:
client_id
– Your client Id (required)hostname
– Override the default host API calls are issued to
Performs a get request. The method takes two parameters:
pathname
– Request pathname or URL (required)params
– Request parameters (see API documentation page for possible values)
Saves the specified resource to the local file system. The method takes two parameters:
pathname
– Remote pathname or URL (required)filename
– Local pathname (required)
Various examples can be found in the examples directory on GitHub.com. Also have a look at the RunKit, where you can test this library.
soundcloud-api-client is licensed under the MIT License.