Skip to content

backuprepos/soundcloudr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

soundcloudr

Build Status npm version

An express soundcloud downloader module

Prerequisites

  • Node.js > 0.10.x or iojs > 1.0.4
  • NPM
  • A Soundcloud client id - can be obtained here

Installation

In your project root do:

npm install soundcloudr --production --save

Reference

###setClientId(clientId) Sets the Soundcloud client id for the session.

###getStreamUrl(url, callback) Given a valid Soundcloud track url, this will give the direct stream url for that track.

###download(url, res, callback) Given a valid Soundcloud track url, this will download the direct stream url and pipe it to the Express response object causing a download of the track to happen in the browser.

Usage

Without Express

var soundcloudr = require('soundcloudr');
var fs = require('fs');

soundcloudr.setClientId(fs.readFile('clientId.txt', 'UTF-8'));

soundcloudr.getStreamUrl('https://soundcloud.com/annie-mac-presents/free-music-monday-jakwob-fade', function(err, url) {
	if(err) {
		return console.log(err.message);
	}
	// Do something with the stream url
	console.log('My stream URL is: ' + url);
});

With Express

var express = require('express');
var app = express();
var soundcloudr = require('soundcloudr');
var fs = require('fs');

soundcloudr.setClientId(fs.readFile('clientId.txt', 'UTF-8'));

app.get('/download', function(request, response, next) {
	var url = request.query.url;

	soundcloudr.download(url, response, function(err) {
		if(err) {
			response.status(err.status).json({
				message: err.message
			});
		}
	});
});

Disclaimer

This library should not be used to infringe copyright, only download music that is free to download or is licensed in such a way that downloading will not infringe copyright.

License

Licensed under the MIT license

About

🔉 A node soundcloud downloader module

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%