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

pandora-api

v1.0.3

Published

A Node.js Port of the Unofficial Pandora Radio API

Downloads

3

Readme

PandoraAPI

This is a node.js version of the unofficial Pandora API. Due to the fact that it is unofficial, I will not be publishing it as a node module. On the other hand, I will build it like a node module and encourage that if you want to use it you can clone it into a folder and require it from there.

What about docs? Here's a GitHub IO url for the autogen documentation. https://firecontroller1847.github.io/Pandora.js-Docs/

I don't like the look of your docs! Okay, that's fine. Checkout the instructions below to generate docs. Feel free to modify the package.json :)

  • Using Yarn
    • yarn install
    • yarn run docs
  • Using NPM
    • npm install
    • npm run docs

Then, just open up index.html in the new folder called out.

Example Usage

Here are some examples on how to use the module.

Logging In

Method #1 (Preferred)

const { Client } = require('../node-pandora-api');
const client = new Client();
(async () => {
  await client.login('myusername', 'mypassword');
  console.log('Client Ready!');
});

Method #2

const { Client } = require('../node-pandora-api');
const client = new Client();
client.on('ready', () => {
  console.log('Client Ready!');
});
client.login('myusername', 'mypassword');

Method #3

const { Client } = require('../node-pandora-api');
const client = new Client();
client.login('myusername', 'mypassword').then(() => {
  console.log('Client Ready!');
});

Important Note

All further examples should happen AFTER you're logged in.

Getting A Station

const stations = await client.user.getStations();
console.log(JSON.stringify(stations, null, 2));

Simple right?

Getting Some Random Songs

Because, it's Pandora. This is what the app does.

// Assuming you now have the stations variable from above.
const station = stations.first(); // Get the first station, unless you want to sift through them and find the one you want.
const songs = await station.getSongList(true); // This is the first time we're getting the song list, so we need to specify that using `true`.
console.log(JSON.stringify(songs, null, 2));

Congradulations, you've successfully gotten some songs! Now, just make a get request to one of the song's audioURL's, and you're on your way!

⚠ This Module Is Not Complete

All Pandora methods may not be completed. I've taken the time and effort to reverse engineer the Pandora API (with some help of this doc sheet, although not much), but since Pandora doesn't ensorse the usage of this API, they may change things at will without notice. Versions of this module will break randomly, and patches may or may not be fixed. All pull requests to help add more methods or items to the API are appreciated.

⚠ There are 'with good intent' conditions you should follow!

Pandora does not endorse the usage of this API, and it may even get your account banned. If you use this API to pirate songs or play songs without playing the additional ads for them, you are doing so at your own risk. This API is merely to provide a way to use Pandora in Node.js. What you do with it is on you. If Pandora Media comes after you, sues you, or anything similar because your app is breaking the terms of service (or anything similar), you CANNOT blame this API.

You must ALWAYS play ads on a non-premium user account!