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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gmusicapi-node

v1.0.0

Published

Python bindings for Unofficial Google Music API

Readme

Purpose

This Node library should enable you to invoke from Node the functionality of Simon Weber's Unofficial Google Music API, gmusicapi.

It is not a re-implementation; it binds to existing functionality from the Python module.

The main reason for using this Node module is to stubbornly avoid learning Python.

Requirements

2.7 <= Python version < 3.0

You will need the Python gmusicapi to be working already.

[Here's my instructions](Installing Python gmusicapi.md)!

Installation

Install this Node package to your own Node project.

Via npm

Sorry, we're not on npm yet~

Via GitHub

Install this Node package:

npm install git+ssh://[email protected]:Birch-san/gmusicapi-node.git

Usage

Inclusion

Include the installed package into your Node script using require().

var gmusicapi = require('gmusicapi-node');

Invocation

Basic usage

var gmusicapi = require('gmusicapi-node')();

// attempt to acquire a MobileClient
gmusicapi.acquireMobileClient()
.then(function(bindings) {
	// check what functions are exported by this library
	console.log(bindings);

	return bindings
	.getPlaylists()
	.then(function(results) {
		// you'll get an array of playlists
		console.log(results);
	})
	.catch(console.error)
	.finally(bindings.done);
})
.catch(console.error);

Example output:

[
	{
		"kind": "sj#playlist",
		"name": "かたわ少女",
		"deleted": false,
		"lastModifiedTimestamp": "1412977187235428",
		"recentTimestamp": "1412977136104000",
		"shareToken": "AMaBXykdBzHnRhaVhtpIBrYu6UwQFgaZDOtFL1XTGmMAc6aOEJ4GKvk2ZIVRmPH3m0dZFbTElvznB3b6EcA37NtD0IuHM_hU0w==",
		"clientId": "996CEDEF0DFAE259",
		"ownerProfilePhotoUrl": "(redacted)",
		"ownerName": "(redacted)",
		"accessControlled": false,
		"creationTimestamp": "1412977136108902",
		"id": "8bcfdbb5-b22e-3441-b815-a58d5b53afd9"
	}
]

Advanced usage

You can use a non-default configuration like I do:

var options = {
	// these options will be passed to `python-shell`
	pyshellOptions: {
		pythonPath: '/usr/local/bin/python',
		env: {
			// which directories (delimited by : character) Python should inspect when importing modules
			'PYTHONPATH': '/usr/local/lib/python2.7/site-packages'
		}
	},
	credentials: {
		email: '[email protected]',
		password: 'hey'
	},
	/*
	// or use credentials from keychain, like so:
	credentials: {
		usekeychain: true,
		email: '[email protected]
	},
	*/
	// skipping sanity checks saves a bit of time, if you're sure your Python environment works
	skipSanityChecks: true
};

var lib = require('../src/js/index')(options);

lib.acquireMobileClient()
.then(function(bindings) {
	return bindings
	.getPlaylists()
	.then(console.log)
	.catch(console.error)
	.finally(bindings.done);
})
.catch(console.error);

Options

If default state doesn't work out for you, require() the library with some options

pyshellOptions is passed to python-shell. Any unrecognised options within this object will be passed through to child_process.spawn's options object.

You can assign a string to pyshellOptions.pythonPath to specify the path to your intended Python executable.

You can assign an object of key-value pairs to pyshellOptions.env to provide environment variables to child_process.spawn.

Here's an example of that:

var options = {
	// these options will be passed to `python-shell`
	pyshellOptions: {
		pythonPath: '/usr/local/bin/python',
		env: {
			// which directories (delimited by : character) Python should inspect when importing modules
			'PYTHONPATH': '/usr/local/lib/python2.7/site-packages'
		}
	}
};

var lib = require('../src/js/index')(options);

We also have options for:

Option | type | Description ------ | ---- | ----------- logLevel | string | Print to console.log various verbosity of messages from this library. Defaults to "info". Possible values are: ["info"] skipSanityChecks | boolean | Skip sanity checks on startup credentials | object | see credentials spec below

credentials:

Option | type | Description ------ | ---- | ----------- usekeychain | boolean | Consult Mac OS X Keychain for your Google account's password instead of specifying password. Defaults to false. email | string | Your Google account password | string | Your Google password keychainSpec | object | see keychainSpec below

keychainSpec:

Option | type | Description ------ | ---- | ----------- account | string | Which Account to search for in Keychain (example: [email protected]). Defaults to the email provided in credentials. service | string | Which Service to search for in Keychain. Defaults to 'accounts.google.com'. type | string | What type of password to search for in Keychain. Defaults to 'internet'.

You can populate your Keychain with a Google password like so:

security add-internet-password -a [email protected] -s accounts.google.com -w YOURPASSWORDHERE

Development

Check out this repository:

git clone [email protected]:Birch-san/gmusicapi-node.git

Experimenting

If you are have checked out this repository to develop it, probably you want to invoke its code.

You can make a "scratch" file (a.k.a. a "fiddle") within this repository to invoke functionality from within this repository.

Saving fiddles into repository

The whole directory scratch/ is .gitignored, so feel free to add files there.

For example, you could make a file scratch/scratch.js:

var gmusicapi = require('../src/js/index.js');

console.log(gmusicapi);

Alternatively: any file ending in .scratch.js is .gitignored also, so you could save a fiddle file somewhere else if you prefer.

Running your fiddles

You're using Sublime Text, right? Add a new build system.

{   
  "cmd": ["/usr/local/bin/node", "$file"],   
  "selector": "source.js"   
}

Now when you press Cmd+B upon a .js file, it will run your fiddle.

Releases

npm

Minor release

Finish your commit, then run:

npm version patch
npm publish
git push origin master --follow-tags

Or run sh ./npm-release-minor.sh

Major release

Finish your commit, then run:

npm version major
npm publish
git push origin master --follow-tags

Or run sh ./npm-release-major.sh