This is a Node.js port of Brian Ustas's Pandata module, originally written for Ruby. Node.js is asynchronous, making this module significantly faster than the original. Promises are used to handle sequential and parallel asynchronous requests.
It is a library for downloading a user's Pandora.com data. This data includes:
- Playing Station*
- Recent Activity*
- Bookmarks (artists, tracks)*
- Likes (albums, artists, stations, tracks)
Where possible, Pandora feeds are used (indicated by an asterisk above).
Pandata can only access public Pandora profiles (profiles are public by default). Users can make their profiles private in Pandora's settings.
As a library
First, grab a Pandora webname from an email address, and create a new Pandata scraper for that user:
Pandata = require 'pandata' # Pandata.get takes either an email or a Pandora webname, and a callback to # execute once a webname is retrieved Pandata.get 'firstname.lastname@example.org', (webname) -> # Create a new scraper for the user wills_scraper = new Pandata(webname)
Next, use the API to scrape data. The API methods return promises for the data. Use them like so:
# Get recent activity wills_scraper.recent_activity() .then( # The promise resolved successfully (data) -> console.log "Will's recent activity on Pandora:" console.log data # Do something with the data # The promise was rejected for some reason (reason) -> console.log "Something went wrong!" console.error reason # Error handling ) # Get only liked tracks wills_scraper.likes('tracks') .then( # The promise resolved successfully (data) -> console.log "Tracks Will likes on Pandora:" console.log data # Do something with the data # The promise was rejected for some reason (reason) -> console.log "Something went wrong!" console.error reason # Error handling )
For more information on the API methods and the data returned, refer to the the API documentation.
A note on promises
See when's documentation for more information.
As a command-line tool
If you need to use Pandata on the command line, then there's no need for a Node.js version, since the Ruby version provides CLI functionality. See the instructions on how to install the original Ruby version in the Pandata repository.
The original ruby version was written by Brian Ustas.