Search code examples
macosapplescript

How to get current playing song on mac by command line tools?


I can only find some applescripts on Google with specific music app(like itunes, spotify, etc) to get current playing song.

But now I'm using Netease Music which not supporting to be controled by applescript, I wonder if there is any universal way to get current playing song info via mac media center?

Applescript and other command line tools both ok.

enter image description here


Solution

  • I made a cli tool that lets you read properties from the private MediaRemote framework.

    https://github.com/kirtan-shah/nowplaying-cli

    Since it uses private APIs, it may break with future macOS updates but is currently working on Ventura 13.1.

    Here is an example that will retrieve the song name: now playing center screenshot

    nowplaying-cli usage