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

echojs

v0.1.4

Published

Echonest API for Node.js and browsers.

Downloads

20

Readme

echonest.js

A node.js client for the Echonest API.

Build Status

Installation

To use it with node:

npm install echonest

Get an API key.

example usage in javascript

echonest = require('echonest');
var myNest = new echonest.Echonest({
    api_key: 'XXX YOUR API KEY XXX'
});

myNest.artist.familiarity({
    name: 'portishead'
}, function (error, response) {
    if (error) {
        console.log(error, response);
    } else {
        console.log('familiarity:', response.artist.familiarity);
        // see the whole response
        console.log('response:', response);
    }
});

output:

familiarity: 0.8310873556337086
response: { status: { version: '4.2', code: 0, message: 'Success' },
    artist: 
{ familiarity: 0.8310873556337086,
        id: 'ARJVTD81187FB51621',
        name: 'Portishead' } }

To search with multiple buckets (or descriptions, styles, moods), use an array: style: ['lounge', 'metal'].

The tests touch every endpoint of the live API--including uploading a tune to track/upload--so see them for real examples. They're in coffeescript. You'll also need to visit the Echonest API Documentation to see what parameters each method accepts and what to expect in the response.

There's some pretty neat stuff in playlist generation (echonest is used by Spotify radio) and song search.

Contributing

  • clone
  • install dev dependencies -- npm install
  • install rake
  • run the tests -- rake test

The echonest.js file distributed by npm is generated from coffeescript, and not checked into the repository. To see it, run rake build.

It could use some fancier handling of echonest's response codes. It could also probably work outside node.js in a browser without too much work. It's missing some of the slicker stuff from other client libraries.

Exploring

The default callback logs errors and responses. These are the loudest 15 songs from the southern hemisphere in d minor (the saddest of all keys), from the coffeescript repl:

coffee> echonest = require 'echonest'
{ Echonest: [Function: Echonest] }
coffee> mynest = new echonest.Echonest(api_key: 'XXX')
{ api_key: 'XXX',
  api_version: 'v4',
  host: 'http://developer.echonest.com',
  jsonclient: {},
  song:
   { search: [Function],
     profile: [Function],
     identify: [Function] },
  artist:
   { biographies: [Function],
     blogs: [Function],
     familiarity: [Function],
     hotttnesss: [Function],
     images: [Function],
     list_terms: [Function],
     news: [Function],
     profile: [Function],
     reviews: [Function],
     search: [Function],
     extract: [Function],
     songs: [Function],
     similar: [Function],
     suggest: [Function],
     terms: [Function],
     top_hottt: [Function],
     top_terms: [Function],
     twitter: [Function],
     urls: [Function],
     video: [Function] },
  track:
   { analyze: [Function],
     profile: [Function],
     upload: [Function] },
  playlist:
   { basic: [Function],
     static: [Function],
     dynamic: [Function],
     session_info: [Function] },
  catalog:
   { create: [Function],
     update: [Function],
     status: [Function],
     profile: [Function],
     read: [Function],
     feed: [Function],
     list: [Function],
     delete: [Function] } }
coffee> # loudest songs from the southern hemisphere in d minor
coffee> mynest.song.search(sort: 'loudness-desc', max_latitude: 0, key: 'd', mode: 0) 
err:  [Error: Bad status code from server: 400]
data:  { status:
   { version: '4.2',
     code: 5,
     message: 'key - Invalid value for parameter: "key" must be a whole number' } }
coffee> # loudest songs from the southern hemisphere in d minor, take 2
coffee> mynest.song.search(sort: 'loudness-desc', max_latitude: 0, key: 2, mode: 0)
err:  null
data:  { status: { version: '4.2', code: 0, message: 'Success' },
  songs:
   [ { artist_id: 'AROJN321187B9A1967',
       id: 'SOHSSIY12D8578F65A',
       artist_name: 'Sissy Spacek',
       title: 'Bone Flour' },
     { artist_id: 'ARYSZJY1187B9AA68B',
       id: 'SOYQFVQ131343A55FE',
       artist_name: 'Prurient',
       title: 'Troubled Sleep' },
     { artist_id: 'ARG1JWO1187B993356',
       id: 'SOZZDMT12A8C145013',
       artist_name: 'Massimo',
       title: 'Hello Dirty 1' },
     { artist_id: 'ARTG2FK1187B99A5B2',
       id: 'SODBQCA12AB0183BA2',
       artist_name: 'Landed',
       title: 'FM 91.1' },
     { artist_id: 'ARWDKKI130D26542D8',
       id: 'SOMGUYA131F71D6F1A',
       artist_name: 'Fucked',
       title: 'Lloyd+Robbie3' },
     { artist_id: 'AREBLP31187FB4F35F',
       id: 'SOKJANR13152A73068',
       artist_name: 'Merzbow',
       title: 'Minotaurus' },
     { artist_id: 'ARCMHNT12F54FADAC1',
       id: 'SOBOEME130516E3532',
       artist_name: 'Wenaki',
       title: 'Velocity' },
     { artist_id: 'ARCMHNT12F54FADAC1',
       id: 'SOYSVXP1316771415E',
       artist_name: 'Wenaki',
       title: 'Velocity' },
     { artist_id: 'AR1D1ML1187B98C004',
       id: 'SOMEYIT130516E0457',
       artist_name: 'Gerritt & John Wiese',
       title: 'Untitled' },
     { artist_id: 'AR1D1ML1187B98C004',
       id: 'SOLNVGU12D9F521519',
       artist_name: 'Gerritt & John Wiese',
       title: 'Untitled' },
     { artist_id: 'AR1D1ML1187B98C004',
       id: 'SOQJPAN13134386EFE',
       artist_name: 'Gerritt & John Wiese',
       title: 'Untitled' },
     { artist_id: 'ARTPWDY11C8A416B06',
       id: 'SOUECOP131343A19BA',
       artist_name: 'Faux Pride',
       title: 'YouSuckDotCom' },
     { artist_id: 'ARUCSL71187B98EC94',
       id: 'SOSUCKF12AB018AA36',
       artist_name: 'Jason Crumer',
       title: 'III. Betrayal After Betrayal' },
     { artist_id: 'ARXMWHU122C86777D1',
       id: 'SOOYLHL130516DD3AD',
       artist_name: 'Big Deformed Head',
       title: 'Most Triumphant Motherfucker...and I Use the Term Triumphant Loo' },
     { artist_id: 'ARMBMKW1187FB5A735',
       id: 'SOBFKVK12AF7299AB9',
       artist_name: 'Autotrash',
       title: 'Sex Ape' } ] }