A tiny, single-user API that takes the song you're playing in Apple Music, or anything you type or share, and drops it into a fixed YouTube playlist.
POSTs to this site's API with a shared secret.POST/api/add-song
Header: Authorization: Bearer <SHORTCUT_TOKEN>
Request body:
{ "title": "Blinding Lights", "artist": "The Weeknd" }
Success response:
{
"ok": true,
"message": "Added: The Weeknd - Blinding Lights",
"videoId": "abc123",
"videoTitle": "The Weeknd - Blinding Lights",
"playlistItemId": "xyz789",
"alreadyInPlaylist": false
}
POST/api/add-text
Same header. Send whatever was typed or shared: an Apple Music song link, a YouTube link, Shazam share text, or a title and artist.
{ "text": "https://music.apple.com/us/song/blinding-lights/1488408568" }
Every response includes message, a ready-to-show Added: ... or Failed: ... line. Failures return { "ok": false, "error": "...", "message": "..." } with a non-2xx status.
The playlist owner mints a YouTube refresh token once via /api/oauth/start, then stores these as Cloudflare Pages secrets:
SHORTCUT_TOKEN — shared secret gating the APIYOUTUBE_CLIENT_ID, YOUTUBE_CLIENT_SECRETYOUTUBE_REFRESH_TOKENYOUTUBE_PLAYLIST_IDUntil those are set, the API responds with a configuration error.