Play new songs from YouTube in the browser
YouTube's bot checks block yt-dlp from fetching audio on the server, so suggested songs now play in YouTube's embedded player, kept out of sight, in the browser. yt-dlp is only used to search. - GET /api/discover/youtube/<id> returns candidate video IDs, best first, or the one that played before (?refresh=true searches again). - PUT /api/discover/youtube/<id> remembers the video that played. - The UI tries the next candidate when a video can't be embedded, searches again when a remembered video is gone, and skips the song otherwise. - Drop the YouTube audio proxy, and Deno from the image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
93e12cfc72
commit
c84e7e715d
11 files changed
+495
-181
No files matched your search
@@ -24,8 +24,8 @@ otherwise against the query data in `.sqlx/`. After changing a query, update tha
|
||||
|
||||
### Docker Compose
|
||||
|
||||
`compose.yaml` runs playlistd with its own Postgres database. The image includes the web UI,
|
||||
yt-dlp and Deno (which yt-dlp needs for YouTube).
|
||||
`compose.yaml` runs playlistd with its own Postgres database. The image includes the web UI and
|
||||
yt-dlp (for finding new songs on YouTube).
|
||||
|
||||
```sh
|
||||
cp .env.example .env # then fill in your Subsonic server and a database password
|
||||
@@ -39,8 +39,8 @@ your network. If your
|
||||
Subsonic server runs on the Docker host, use `http://host.docker.internal:4533/rest` as
|
||||
`SUBSONIC_BASE`.
|
||||
|
||||
YouTube changes often break older yt-dlp versions, and the image installs the latest one when it's
|
||||
built, so rebuild it now and then to keep new songs playing:
|
||||
YouTube changes can break older yt-dlp versions, and the image installs the latest one when it's
|
||||
built, so rebuild it now and then to keep finding new songs:
|
||||
|
||||
```sh
|
||||
docker compose build --pull && docker compose up -d
|
||||
@@ -74,7 +74,7 @@ The package is written to `target/debian/`. It installs the web UI to `/usr/shar
|
||||
which the default config serves at `/`. `cargo deb` refuses to build the package if the UI hasn't been
|
||||
built.
|
||||
|
||||
The package recommends `yt-dlp`, for playing suggested songs from YouTube. Distribution packages of
|
||||
The package recommends `yt-dlp`, for finding suggested songs on YouTube. Distribution packages of
|
||||
yt-dlp are often too old to work with YouTube, so you may want a current one instead, e.g. from pip.
|
||||
|
||||
### Logging
|
||||
@@ -191,9 +191,14 @@ Every candidate's MusicBrainz genres are compared with each mix's, and it's sugg
|
||||
it fits best (if it fits well enough), skipping songs already in your library.
|
||||
|
||||
In the UI, songs from your library stream from Subsonic. New songs are found on YouTube with
|
||||
[yt-dlp](https://github.com/yt-dlp/yt-dlp) and streamed through playlistd, so yt-dlp needs to be
|
||||
installed on the server (keep it up to date: YouTube changes often break older versions). You can
|
||||
like a new song to keep it in "Liked new songs", or hide it so it isn't suggested again.
|
||||
[yt-dlp](https://github.com/yt-dlp/yt-dlp) on the server (keep it up to date: YouTube changes can
|
||||
break older versions), and play in the browser, in YouTube's embedded player kept out of sight.
|
||||
Playing them from the browser, rather than the server, keeps YouTube's bot checks from blocking
|
||||
them. If the first video found can't be embedded, the next search result is tried. You can like a
|
||||
new song to keep it in "Liked new songs", or hide it so it isn't suggested again.
|
||||
|
||||
Mobile browsers pause embedded YouTube videos when the screen locks or the tab is in the
|
||||
background, so new songs only play while the UI is open.
|
||||
|
||||
"Play mix" plays a mix's new songs in random order with songs you already know (the songs in the
|
||||
mix you've played recently) mixed in evenly, so that `familiar_ratio` of what you hear is familiar.
|
||||
@@ -261,7 +266,8 @@ The UI uses these endpoints under `/api/discover`:
|
||||
| `POST /rules/<id>/rebuild` | Rebuild a rule's mixes on the next daemon tick |
|
||||
| `GET /stream/<song id>` | Stream a library song from Subsonic |
|
||||
| `GET /cover/<cover art id>` | Library cover art from Subsonic |
|
||||
| `GET /youtube/<suggestion id>` | Stream a suggested song from YouTube |
|
||||
| `GET /youtube/<suggestion id>?refresh=` | YouTube videos for a suggestion, best first (`refresh` searches again) |
|
||||
| `PUT /youtube/<suggestion id>` | Remember the video that played (`video_id`) |
|
||||
|
||||
and these under `/api/tracked` for tracked playlists:
|
||||
|
||||
|
||||
Reference in new issue
Block a user