An easy to use, minimal dependency Soundcloud song downloader.
This module uses only one dependency: Phin. This means that node-scdl is very lightweight.
To install:
npm install node-scdl
Simiply require the scdl package just like you would with any other module. Then create a new instance of the SoundCloudDownloader client using a client ID. You can find a client ID in the request headers of the Soundcloud website. Open the developer tools in your favorite browser,
const SCDL = require('node-scdl')
const SoundCloudDownloader = new SCDL('abcdefghijklmnopqrstuvwxyz123456') // This fake Client ID can be replaced with a valid one
console.log(SoundCloudDownloader.getInfo(SoundCloudDownloader.getID('https://soundcloud.com/tarroofficial/alone-ft-jutes-noey'))) // Should return a JSON response of Soundcloud Metadata (ie. {title: "alone ft. jutes x noey", artist: "tarro"})
- Open the Web Developer Tools in your favorite browser
- Go to the network tab
- Open up a tab with a SoundCloud song
- Select a request/response that contains song data. It should contain about 3 JSON items, one of them being a client ID
- Copy and paste that
Creates a new instance of the Soundcloud Downloader
Params
clientID
(String) - A valid Soundcloud-API-V1 Client ID
Usage
new SoundCloudDownloader = new SCDL(clientID)
Gets all of the Soundcloud Metadata for the track
Params
id
(Number/String) - A valid Soundcloud Track ID
callback
(Function) (Optional) - A callback function
Returns
Promise<JSON>
- Soundcloud Track Metadata (otherwise returns Promise<JSON>
to the callback if one is provided)
Usage
SoundCloudDownloader.getInfo(12345789)
Accepts the URL and resolves it to an ID that can be used with other SCDL functions
Params
url
(Number/String) - A valid Soundcloud Track URL
cb
(Function) (Optional) - A callback function
Returns
Promise<Number>
- Soundcloud Track ID (otherwise returns Promise<Number>
to the callback if one is provided)
Usage
SoundCloudDownloader.getID('https://soundcloud.com/tarroofficial/alone-ft-jutes-noey')
Resolves the ID for a soundcloud track and downloads the song
Params
id
(Number/String) - A valid Soundcloud Track ID
callback
(Function) (Optional) - A callback function
Returns
Promise<ReadableStream>
- A ReadableStream containing song data (otherwise returns Promise<ReadableStream>
to the callback if one is provided)
Usage
SoundCloudDownloader.getStream(12345789)