npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shufflerfm

v0.2.2

Published

Shuffler.fm API client for Node.js

Downloads

19

Readme

 node-shufflerfm

Shuffler.fm API client for Node.js and Browserify.

Install

npm install shufflerfm

Example

var ShufflerFM = require('shufflerfm');

var sfm = new ShufflerFM('YOUR APP KEY', 'YOUR APP SECRET');

sfm.getGenre('uk+garage', function (err, data, response) {
    if (err) throw err;

    // do something with data
    console.dir(data);
});

API

new ShufflerFM('APP_KEY', 'APP SECRET')

Create an instance of a client. 'APP_KEY' and 'APP SECRET' are mandatory - http://developers.shuffler.fm/#app_key.

Returns a bunch of self-descripting methods. Details about every Shuffler.fm API resource is available here - http://developers.shuffler.fm/#resources.

Activities

http://developers.shuffler.fm/#activities

getActivityById(id, callback)

Artists

http://developers.shuffler.fm/#artists

getArtists([query], callback)
getArtistById(id, callback)

Authorizations

http://developers.shuffler.fm/#authorizations

createOAuthUrl(scope, redirect_uri)
  • scope {String|Array} - required and should be at least one of the following: users.r, users.favorites.r, users.favorites.m, users.subscriptions.r, users.subscriptions.m
  • redirect_uri {String} - required and should be under the same domain as the one in your app's settings (http://shuffler.fm/developers/apps)

Returns an uri string (e.g. https://shuffler.fm/authorizations/auth?app_key=YOUR-APP-KEY&scope=users.r&redir_uri=http%3A%2F%2Fmyurl.net) that should be opened in browser.

var ShufflerFM = require('shufflerfm');

var sfm = new ShufflerFM('YOUR APP KEY', 'YOUR APP SECRET');
var oauthUrl = sfm.createOAuthUrl(['users.r', 'users.favorites.r'], 'http://myurl.net');

console.log(oauthUrl);
// -> https://shuffler.fm/authorizations/auth?app_key=YOUR-APP-KEY&scope=users.r,users.favorites.r&redir_uri=http%3A%2F%2Fmyurl.net`
// open in browser to follow a three-legged OAuth 2.0 flow
// this will return you `code` that you will need later
getAuthToken(code, callback)
  • code {String} - required, it's received as query param in redirect uri (after user follows the OAuth uri and grants access to your application)

Returns object with access_token and userId as second argument in callback function.

Charts

http://developers.shuffler.fm/#charts

getChartsPopular(callback)

Channels

http://developers.shuffler.fm/#channels

getChannel(channel, [position], callback)

Genres

http://developers.shuffler.fm/#genres

getGenres(callback)
getGenreByName(genre, callback)
getGenreSites(genre, callback)

Sites

http://developers.shuffler.fm/#sites

getSites([query], callback)
getSiteById(id, callback)
getFeaturedSites(callback)

Tracks

http://developers.shuffler.fm/#tracks

getTracks(callback)
getTrackById(id, callback)

To Do

Implement API resources that need OAuth - http://developers.shuffler.fm/#authorizations, e.g.:

  • [x] Authorizations
  • [ ] Subscribtions
  • [ ] Users

License

MIT Licensed

Copyright (c) 2014-2015 Dmitri Voronianski [email protected]

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.