Use this community-maintained skill to control QQ Music's web player (y.qq.com) through a browser DevTools/CDP endpoint.
This skill uses the Chrome DevTools Protocol (CDP) to automate QQ Music's web UI. It is not affiliated with Tencent or QQ Music. CDP is a powerful protocol — the following safeguards are in place to minimize its blast radius:
The script only operates on y.qq.com tabs. Two layers of domain validation are enforced:
y.qq.com). Non-matching tabs are rejected.Runtime.evaluate call, the script queries location.hostname of the connected page and verifies it is still y.qq.com. If the page has navigated to a different domain since connection, the call is rejected with an error.This prevents the script from reading or manipulating content on other websites (email, banking, etc.), even if the page navigates away after the initial connection.
We strongly recommend launching the browser with --user-data-dir pointing to a dedicated directory:
chrome --remote-debugging-port=9222 --user-data-dir=/path/to/qq-music-profile
This ensures:
The script probes only one port by default — read from .cdp-port cache file, or falling back to 9222. It does not scan port ranges. This minimizes the chance of accidentally connecting to unrelated DevTools endpoints.
This skill does not use OpenClaw's built-in browser tool. It connects to CDP directly via WebSocket from a local Node.js script. No SSRF policy relaxation is needed in OpenClaw's configuration.
| Capability | In scope? | Notes |
|---|---|---|
| --- | --- | --- |
| Execute JS in y.qq.com tabs | ✅ | Core functionality — clicks buttons, reads DOM. Domain re-checked before every call. |
| Execute JS in non-y.qq.com tabs | ❌ | Blocked by domain whitelist |
| Read cookies from y.qq.com | ⚠️ | Technically possible via CDP, but the script never does this |
| Access other browser tabs | ⚠️ | CDP can list all tabs, but the script only interacts with y.qq.com tabs |
| Access filesystem | ❌ | CDP Runtime.evaluate runs in page sandbox |
| Install extensions | ❌ | The script does not use Target.createBrowserContext or extension APIs |
--user-data-dir for isolation is the strongest mitigation.Runtime.evaluate with arbitrary JavaScript on QQ Music pages. This is equivalent to using the browser's DevTools console on that page.fetch and WebSocket)y.qq.com (needed for liked songs, playlists, and like/unlike)This skill connects to a browser via CDP. The Agent needs to:
Run the built-in browser status tool to get the current cdpPort, then write it to .cdp-port:
browser status → read cdpPort from response (e.g. 19011)
Write the port number to: <skill-directory>/.cdp-port
The .cdp-port file should contain only the port number, nothing else. Example content: 19011
node qq-music-ctl.js doctor
Check that status is "ready". If status is "connected_no_qq_music_tabs", open QQ Music first via node qq-music-ctl.js init. If status is "no_endpoint", the cached port may be stale — go back to Step 1.
The user must have logged in to y.qq.com in the browser at least once. If there are no QQ Music tabs:
node qq-music-ctl.js init
This opens https://y.qq.com/ in a new tab. The user may need to log in manually the first time.
> Note: This skill does NOT require any OpenClaw SSRF policy changes. It connects to CDP directly, not through OpenClaw's browser tool.
If any command fails with "No DevTools endpoint found":
browser status to get the current cdpPort.cdp-port with the new port numberAll actions go through the bundled script:
node qq-music-ctl.js <action> [args...]
All output is JSON on stdout. Exit code 0 = success, 1 = error.
The script resolves the CDP port from:
.cdp-port file — a single-line file in the same directory as qq-music-ctl.js, containing just the port number (e.g. 19011).9222 — the Chrome documentation default.All connections are restricted to 127.0.0.1. Remote endpoints are not supported.
> For OpenClaw Agents: Run browser status (built-in tool) → read cdpPort from the response → write it to .cdp-port. The script will then use it automatically on every subsequent call. If a command fails with "No DevTools endpoint found", re-run browser status, update .cdp-port, and retry.
| Action | Description |
|---|---|
| --- | --- |
play | Resume playback (idempotent) |
pause | Pause playback (idempotent) |
toggle | Toggle play/pause |
next | Next track |
prev | Previous track |
status | Current track, artist, time, duration, play state |
| Action | Description |
|---|---|
| --- | --- |
search | Search for a song and play best match |
search-artist | Search for an artist and open their page |
play-artist-all-songs | Play all songs by an artist |
search-album | Search for an album and play it |
| Action | Description |
|---|---|
| --- | --- |
play-liked | Play all liked songs (clicks "播放全部") |
play-liked-random | Randomly play one liked song from the visible page |
like | Like current song (idempotent; returns already_liked if already liked) |
unlike | Unlike current song (idempotent; returns already_unliked if not liked) |
| Action | Description |
|---|---|
| --- | --- |
list-playlists | List all created playlists with name, song count, and numeric ID |
create-playlist | Create a new playlist (max 20 characters) |
add-to-playlist | Add the currently playing song to a playlist by name |
play-playlist | Play a playlist by its numeric ID |
| Action | Description |
|---|---|
| --- | --- |
mode | Show current play mode |
mode list | Set to list loop (列表循环) |
mode single | Set to single loop (单曲循环) |
mode random | Set to shuffle (随机播放) |
mode order | Set to sequential (顺序循环) |
| Action | Description |
|---|---|
| --- | --- |
screenshot [path] | Capture a screenshot of the QQ Music tab |
tabs | List all detectable browser tabs |
init | Open QQ Music if no tab exists |
doctor | Full environment diagnostic: port config, endpoint status, QQ Music tabs |
.cdp-port (or falls back to 9222), then probes 127.0.0.1: for a DevTools HTTP endpoint (/json/version + /json/list)./player URL) is preferred for transport controls (play/pause/next/prev/status). A separate browse-tab is used for search, navigation, and playlist operations.Runtime.evaluate over CDP to run JavaScript in the page context. No Puppeteer or Playwright dependency.fs, path, WebSocket, fetch). No npm install needed.Runtime.evaluate call, the script verifies the page's location.hostname is still on y.qq.com. If the page has navigated away, the call is rejected with an error.init opens a blank tab and navigates to https://y.qq.com/.add-to-playlist, if a newly created playlist is not yet visible in the player's menu, the player page is automatically reloaded to refresh the cache and retry.like and unlike are idempotent and report the current state.create-playlist accepts names up to 20 characters (QQ Music web limit).play-liked uses the "播放全部" button which queues all liked songs in the player, but play-liked-random can only pick from the visible ~10..cdp-port may be stale, or no browser is running with remote debugging. Re-run browser status, update .cdp-port, and retry. Run node qq-music-ctl.js doctor for detailed diagnostics..cdp-port, re-query via browser status, and write the new port.search or play-liked) to make the player tab appear.QQ_MUSIC_PAGE_WAIT_MS for slow connections, or QQ_MUSIC_PROBE_TIMEOUT_MS for slow endpoint discovery..cdp-port file is a local cache and should be added to .gitignore. It is not part of the published skill.This is a community-maintained tool for personal learning and research. It automates the QQ Music web UI through a user's own browser — equivalent to manual DevTools console usage. It is not an official QQ Music/Tencent plugin.
It does not reverse-engineer server APIs, extract music files, or bypass payment restrictions.
Users are responsible for complying with QQ Music's Terms of Service. If you receive a takedown notice from the rights holder, stop using this skill immediately.
Open-source, non-commercial, and provided as-is with no warranty.
共 1 个版本