UNPKG

i1-soundcloud

Version:

tiny client to the soundcloud `i1/tracks#streams` resource

28 lines (20 loc) 1.02 kB
// example.js // Exposes a SoundCloud tracks available streams. // https://github.com/soundcloud/soundcloud-javascript/issues/12 // Require the library. var i1 = require('../index.js'); // Insert your own API key here. // var key = require('getconfig').public_client; var key = 'b45b1aa10f1ac2941910a7f0d10f8e28'; // Insert the track's permalink_url here. var song = 'https://soundcloud.com/promnitebeats/used-to-be-unity'; // Instantiate a new client. var client = new i1({ key: key }); // Make a request to `api/i1/tracks/{id}/streams` client.getStreams(song, function (err, body) { // Something like this should appear: // { // "http_mp3_128_url":"https://ec-media.soundcloud.com/cg8OrQS3UvET.128.mp3?f10880d39085a94a0418a7ef69b03d522cd6dfee9399eeb9a522019b6dfbb63c00f1cbeae466d325a3ca9e6206094aed3ba21386754b94be1ec3d3b20c61c2155d40728792\u0026AWSAccessKeyId=AKIAJNIGGLK7XA7YZSNQ\u0026Expires=1407238059\u0026Signature=1QVw9%2B3wsQW1XBmq82wP5eBLmxY%3D" // } console.log(body); });