I'd like the most direct way, on a Mac, to launch an Apple Music "radio" station e.g.
- via the command line, without having to manually navigate to the radio tab in iTunes, waiting for it to load, scrolling to find the station etc.
- avoid having to load a URL in Safari first, then wait for iTunes to load (annoying there always seems to be a few seconds delay between the webpage loading and iTunes navigating to the stream).
I attempted to do it with AppleScript.
The link to stations (get it via right click and Share Station) is in this format:
https://itunes.apple.com/gb/station/classical/ra.123456789
(I've obfuscated the numeric ID, just in case it's unique to the logged in user).
Whenever I tell iTunes to open the actual URL, instead what it does is open the last "ordinary" (non-Apple) station I played.
[AppleScript]
tell application "iTunes" to open location "https://itunes.apple.com/gb/station/classical/ra.123456789?ign-mscache=1"
Yet if you look at the webpage the http:// URL gives you (the Connecting to the iTunes Store one) there doesn't seem to be anything different/special in the body onload
javascript.
Best Answer
You don't need AppleScript - can do it from the commandline directly with the right URI.
You're calling itmss:// because you need to hit iTunes itself.
Then, replace the code into the idra.XXXXXXXXX bit. I'm in the USA, so it's /us/station, but I suspect /gb/station would work for you, if you're in the UK.
FYI - you can actually just cmd-space and and paste just the URL into Spotlight to have it run it and open the station in iTunes directly.