- Open 'Script Editor' in macOS (built-in app)
- Switch the language from AppleScript to JavaScript
- Paste the script
- Press Command-S to save, for File Format choose 'Application', for Where choose 'Applications', name it something like RYM.app
- Run the new app (for example using Spotlight)
Last active
December 18, 2025 14:57
-
-
Save agentcooper/562c8978076cf7d1423bd3981b8b7ca1 to your computer and use it in GitHub Desktop.
Open currently playing album from Apple Music in Rate Your Music (https://rateyourmusic.com/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (() => { | |
| const music = Application("Music"); | |
| if (music.playerState() !== "playing") { | |
| return; | |
| } | |
| const app = Application.currentApplication(); | |
| app.includeStandardAdditions = true; | |
| function slugify(str) { | |
| return str | |
| .toLowerCase() | |
| .replace(/[^\w\s-]/g, "") | |
| .replace(/\s+/g, "-") | |
| .replace(/-+/g, "-") | |
| .replace(/^-|-$/g, ""); | |
| } | |
| function cleanAlbumName(album) { | |
| return album | |
| .replace(/\s*\(.*?\)\s*$/g, "") // Remove (...) | |
| .replace(/\s*\[.*?\]\s*$/g, "") // Remove [...] | |
| .trim(); | |
| } | |
| function openURL(url) { | |
| app.doShellScript(`open "${url}"`); | |
| } | |
| const track = music.currentTrack(); | |
| const artistSlug = slugify(track.artist()); | |
| const cleanedAlbum = cleanAlbumName(track.album()); | |
| const albumSlug = slugify(cleanedAlbum); | |
| const directURL = `https://rateyourmusic.com/release/album/${artistSlug}/${albumSlug}/`; | |
| openURL(directURL); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment