Run bundled scripts from the skill root:
scripts/helper.py: search, library, playlists, lyrics, ratings, accountscripts/player.py: playback client and daemon managementscripts/player_daemon.py: persistent Playwright browser daemon./.ytmusic/./.ytmusic/playwright-profileauth check first.Use search to resolve videoId, browseId, or playlistId:
uv run --with ytmusicapi python scripts/helper.py search "<query>" --type songs --limit 5
uv run --with ytmusicapi python scripts/helper.py search "<query>" --type artists --limit 3
uv run --with ytmusicapi python scripts/helper.py search "<query>" --type albums --limit 3
If results are ambiguous, ask the user which one they want.
Check auth before library, playlist, rate, subscribe, home, history, taste, upload, or auth account:
uv run --with ytmusicapi python scripts/helper.py auth check
If auth is missing, do not continue with the requested action yet.
You must explicitly guide the user to provide one of these:
music.youtube.com requestThis is a hard rule:
Use this flow:
music.youtube.com in a logged-in browser./browse, reload, open any matching request, copy the Cookie header value, send it backmusic.youtube.com with a cookie extension and send the file path backauth setup.auth setup succeeds.Preferred default user-facing wording:
You need to sign in to YouTube Music before I can access your library, playlists, account, uploads, or full playback.
Please send me one of these:
1. A Cookie string
2. A cookies JSON file path
Cookie string instructions:
Open a logged-in music.youtube.com page
Open DevTools -> Network
Filter /browse and reload the page
Open any matching request
Copy the Cookie request header value
Send the full Cookie string back to me
Cookies JSON instructions:
Use a cookie export extension such as Cookie-Editor on music.youtube.com
Export cookies as JSON
Save the exported file locally
Send me the file path
Setup commands:
uv run --with ytmusicapi python scripts/helper.py auth setup --cookie '<cookie string>'
uv run --with ytmusicapi python scripts/helper.py auth setup --cookies-file /path/to/cookies.json
uv run --with ytmusicapi python scripts/helper.py search "<query>" [--type songs|artists|albums|playlists|videos]
uv run --with ytmusicapi python scripts/helper.py library playlists
uv run --with ytmusicapi python scripts/helper.py playlist get <playlistId>
uv run --with ytmusicapi python scripts/helper.py playlist create --title "<name>"
uv run --with ytmusicapi python scripts/helper.py playlist add <playlistId> <videoId...>
uv run --with ytmusicapi python scripts/helper.py lyrics <videoId>
uv run --with ytmusicapi python scripts/helper.py related <videoId>
uv run --with ytmusicapi python scripts/helper.py rate <videoId> LIKE|DISLIKE|INDIFFERENT
uv run --with ytmusicapi python scripts/helper.py charts [--country CN|US|KR|JP|ZZ]
Full command reference: references/commands.md
Playback runs through a persistent Playwright browser daemon. The first playback command auto-starts a dedicated browser window and reuses it for later open, play, pause, next, prev, seek, volume, and status commands.
uv run --with playwright python scripts/player.py daemon-start
uv run --with playwright python scripts/player.py open <videoId>
uv run --with playwright python scripts/player.py play
uv run --with playwright python scripts/player.py pause
uv run --with playwright python scripts/player.py next
uv run --with playwright python scripts/player.py prev
uv run --with playwright python scripts/player.py status
uv run --with playwright python scripts/player.py volume <0-100>
uv run --with playwright python scripts/player.py seek <seconds>
uv run --with playwright python scripts/player.py daemon-status
uv run --with playwright python scripts/player.py daemon-stop
Important behavior:
./.ytmusic/playwright-profilemusic.youtube.com in that browser windowopen loads the page but playback is still paused, autoplay was likely blocked and the user may need to click play once in the daemon-managed windowdaemon-status checks whether the background browser is alive without starting a new oneIf playback commands fail, first verify:
music.youtube.com in that browser window if the requested track requires it./.ytmusic/player-daemon.log does not show a launch or Playwright error▶ {title} — {artist} ({position} / {duration})After success, suggest one natural next step such as play, add to playlist, show lyrics, or fetch related tracks.
共 1 个版本