Extracting a track listing from Google Play Music
Why I wanted a track listing
In an effort to tidy up my wife’s music, I needed a complete track listing from Google Play Music to help me track down duplicates and mis-labelled items. My first thought was a Google Apps Script, but there is no API for music. So I looked further and provided you are okay with running Python scripts (and have Python installed) there is an answer.
Pre-requisites to install
There are two things to get onto your computer. They are the PIP installer and the
gmusicapi (unofficial) Python client for Play Music.
- Install PIP by following the instructions here (you may need to run as an Administrator or prefix the commands with
- Install the GMusicAPI by following the instructions here (again as Administrator or using
These done, you can see an example of usage at the top of this linked page.
In essence, create a Python script something like the following, which runs through all the tracks in your library and creates a tab-delimited listing:
from gmusicapi import Mobileclient api = Mobileclient() api.login('firstname.lastname@example.org', 'my-password') library = api.get_all_songs() print ('Artist\tAlbum\tAlbum Artist\tTitle') for track in library: print (track['artist'] + '\t' + track['album'] + '\t' + track['albumArtist'] + '\t' + track['title']).encode('utf-8')
Obviously insert your own email address and password, and remember that in Python the indentation on the last line matters.
The final output for me is a complete listing – though strangely with five more entries than the web site shows (I haven’t narrowed them down as there are nearly 10,000 and I’m not scrolling through them all on the site).
Hopefully that helps someone else out there. Please don’t abuse the ‘API’ as Google may break it for all of us.