Ever had the issue that YouTube’s randomize function does not work on Chromecast? No longer — youtube-playlist-randomizer takes a playlist, shuffles it with the YouTube Data API v3 and saves the result as a brand new playlist.
It runs as a small self-hosted Go web app on port 6270, with an HTMX-powered UI to browse, filter and randomize your playlists.
Features #
- Web UI — browse, filter and randomize playlists from the browser.
- Quota management — keeps track of YouTube API quota usage and automatically pauses and resumes jobs when the quota resets.
- Job persistence — job state is stored in SQLite and survives server restarts.
- Docker support — ready-to-run container image on GHCR.
- Mock mode — run it without YouTube API credentials while developing.
How it works #
- Lists your playlists through the YouTube Data API.
- Fetches all video IDs of the selected playlist.
- Shuffles them with the Fisher–Yates algorithm.
- Creates a new playlist with the shuffled order.
- Inserts the items one by one, pausing and resuming automatically when the API quota runs out.
Running it #
The quickest way is Docker. Grab an OAuth client ID from a Google Cloud project with the YouTube Data API v3 enabled, download it as client_secret.json and run:
docker run -p 6270:6270 \
-e OAUTH_CALLBACK_URL=http://localhost:6270/callback \
-v /path/to/client_secret.json:/config/client_secret.json \
-v ypr-data:/db \
ghcr.io/martynvdijke/ypr:latestOr build it from source (needs Go):
go build -o ypr-server .
./ypr-server -i client_secret.jsonThen open http://localhost:6270 and authorize with your Google account.
Links #
- Source code: github.com/martynvdijke/youtube-playlist-randomizer
- Container image:
ghcr.io/martynvdijke/ypr:latest