soundcloudy

co-ready soundcloud wrapper

soundcloudy

A simple soundcloud api wrapper

Install with npm

$ npm install soundcloudy
var co = require('co');
var soundcloud = require('soundcloudy');
var request = soundcloud(clientId);
 
// user 
var user = 'monstercat'
 
co(function* () {
  // single page 
  var tracks = yield request()
    .resource('users/%s/tracks', user)
    .run()
 
  // all pages with fast pagination 
  var tracks = yield request()
    .resource('users/%s/tracks', user);
    .pageSize(500)
    .concurrency(2)
    .all()
})();
 
var through = require('through');
var request = require('soundcloudy')(clientId);
 
request()
.resource('users/%s/tracks', 'monstercat');
.pageSize(300)
.concurrency(2)
.allStream()
.pipe(through(function(track){
  console.log(track);
}));
 

returns: Request

returns: Request

Set the location for the request

returns: Request

Querystring parameter

returns: co yieldable

Run a single request

returns: Request

Set the batch request level for all and allStream requests

returns: co yieldable

Keep running requests until all pages are fetched. Use .concurrency to adjust request batching. all does requests optimistically until all pages are retrieved.

returns: Readable stream

Stream paged results

The MIT License (MIT)

Copyright (c) 2014 William Casarin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.