# YouTube Music for Raycast

URL: https://www.raycast.com/danieldbird/youtube-music

> Control YouTube Music in your browser: search and play songs, albums and playlists, play, pause, skip, like tracks and see what's playing.

- Install: raycast://extensions/danieldbird/youtube-music
- Author: [Daniel](https://www.raycast.com/danieldbird)
- Installs: 25,936
- Platforms: macOS
- Categories: Media, Applications
- Updated: 2026-12-03
- Source: https://github.com/raycast/extensions/tree/5cbccc5cf50c83323131bb77ca9fcceb99d34a7d/extensions/youtube-music/

## Commands

- **Play Music**: Search YouTube Music and YouTube for songs, albums, artists, playlists, and videos, and play them in the selected browser.
- **Now Playing**: Show the current track, recent history and what is up next.
- **Toggle Play/Pause**: Toggles play or pause of the current track in YouTube Music.
- **Previous Track**: Skips to the previous track in YouTube Music.
- **Next Track**: Skips to the next track in YouTube Music.
- **Like**: Adds current track to "Liked" collection in YouTube Music.
- **Remove Like**: Removes the current track from your liked songs in YouTube Music.
- **Dislike**: Removes current track from "Liked" collection in YouTube Music.

## README

### YouTube Music

Control the YouTube Music tab in the browser with your keyboard.

The `Play Music` command searches YouTube Music songs, albums, artists, and playlists, or YouTube videos, and starts the chosen item in the selected browser. The source dropdown, the **Search in…** action (⌘K), and the **Play Music Source** preference choose which catalogue it reads; albums, artists, and playlists open as grid tiles, and album and playlist tiles start the whole queue rather than a single track, with `⌘↵` opening the track list instead. With the search bar empty it shows your library instead — Albums, Artists, Playlists, Liked songs, and Recently played, each opening into its own list — read from the signed-in music tab, so that tab needs to be signed in to YouTube Music. `Now Playing` shows the current track, the recently played tracks and the queue, with transport and rating actions. How many recently played tracks to list is set in the extension preferences. Both follow the playback setup below; no additional permissions are required.

#### Quick add and per-scope entry points

`Play Music` accepts a launch context that makes **Add to Queue** the primary action, so a hotkey or deeplink can queue a track without opening the action panel:

```
raycast://extensions/danieldbird/youtube-music/play-song?launchContext=%7B%22mode%22%3A%22add%22%7D
```

The same context takes a `source`, which saves opening the dropdown when you only ever search one catalogue. Assign a hotkey to a [Quicklink](https://manual.raycast.com/quicklinks) pointing at one of these and each scope gets its own keystroke:

```
raycast://extensions/danieldbird/youtube-music/play-song?launchContext=%7B%22source%22%3A%22albums%22%7D
```

`source` accepts `both`, `ytmusic`, `albums`, `artists`, `playlists`, or `youtube`.

#### Required Setup

Except for Ardia, the extension controls your browser via AppleScript by running JavaScript in the YouTube Music tab. You must enable **Allow JavaScript from Apple Events** in the browser you select in the extension preferences; otherwise commands will fail (often with "Unknown Error").

##### Ardia

Install **Ardia → Settings → Plugins → Command Line**, select Ardia in the extension preferences, and open `https://music.youtube.com/`. Commands use `~/.local/bin/ardia` to control an existing tab; **Allow JavaScript from Apple Events** is not needed. Player shortcuts respect the **URL Preference**; Now Playing and library/queue actions require a YouTube Music tab. The CLI grants local programs browser-wide control; it is not limited to YouTube Music.

##### Safari

1. Enable the Develop menu: **Safari → Settings → Advanced** → check **Show features for web developers**.
2. Turn on **Develop → Allow JavaScript from Apple Events**.

![Safari: Allow JavaScript from Apple Events in the Develop menu](https://github.com/raycast/extensions/raw/5cbccc5cf50c83323131bb77ca9fcceb99d34a7d/extensions/youtube-music//media/safari-allow-js.png)

##### Chrome, Chromium, or WebCatalog apps

1. Open **View → Developer** in the menu bar.
2. Enable **Allow JavaScript from Apple Events**.

![Chrome/Chromium: Allow JavaScript from Apple Events in View → Developer](https://github.com/raycast/extensions/raw/5cbccc5cf50c83323131bb77ca9fcceb99d34a7d/extensions/youtube-music//media/chromium-allow-js.png)

After enabling this setting, pick the same browser (or WebCatalog app) in the extension’s **Browser where YouTube Music opened** preference.

---

Credit to [@alexstrnik](https://www.raycast.com/alexstrnik) for the [Yandex Music](https://www.raycast.com/alexstrnik/yandex-music) extension which this extension was based on.
