@chenhao6682108/dsh-skill-netease-playlist 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/README.zh.md +6 -0
- package/SECURITY.md +59 -0
- package/package.json +3 -2
- package/skills/netease-playlist/SKILL.md +15 -1
- package/skills/netease-playlist/scripts/.node-flag.txt +1 -0
- package/skills/netease-playlist/scripts/.node-path.txt +1 -0
- package/skills/netease-playlist/scripts/ne-ensure.ps1 +86 -0
- package/skills/netease-playlist/scripts/ne.cmd +23 -1
package/README.md
CHANGED
|
@@ -77,6 +77,13 @@ skills/netease-playlist/
|
|
|
77
77
|
extract-key.ps1 + Dpapi.cs (credential extraction)
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
## Canonical repository
|
|
81
|
+
|
|
82
|
+
This repository is the **canonical source** for `@chenhao6682108/dsh-skill-netease-playlist`. Forks
|
|
83
|
+
and redistributions are not affiliated with or endorsed by the author, and the npm package is
|
|
84
|
+
published only from this repository. This skill reads the desktop client's login state — read
|
|
85
|
+
[SECURITY.md](SECURITY.md) before running any copy that did not come from here.
|
|
86
|
+
|
|
80
87
|
## Notes
|
|
81
88
|
|
|
82
89
|
- Pairs with [`@chenhao6682108/dsh-skill-musicbee`](../dsh-skill-musicbee): download from NetEase, tag the
|
package/README.zh.md
CHANGED
|
@@ -67,6 +67,12 @@ skills/netease-playlist/
|
|
|
67
67
|
extract-key.ps1 + Dpapi.cs(凭据提取)
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
+
## 官方仓库
|
|
71
|
+
|
|
72
|
+
本仓库是 `@chenhao6682108/dsh-skill-netease-playlist` 的**唯一官方源**。任何 fork 或二次分发都与作者无关、
|
|
73
|
+
也不代表作者背书;npm 包只从本仓库发布。本技能会读取客户端登录态——**运行任何非本仓库来源的副本前,
|
|
74
|
+
请先读 [SECURITY.md](SECURITY.md)**。
|
|
75
|
+
|
|
70
76
|
## 注意
|
|
71
77
|
|
|
72
78
|
- 和 [`@chenhao6682108/dsh-skill-musicbee`](../dsh-skill-musicbee) 配套:从网易云下载 → 补标签 → 进 MusicBee。
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
This skill touches your NetEase Cloud Music **login state**, so how it handles credentials is the
|
|
4
|
+
most important thing about it. This file states exactly what it does.
|
|
5
|
+
|
|
6
|
+
## Credential handling
|
|
7
|
+
|
|
8
|
+
1. `extract-key.ps1` reads `%LOCALAPPDATA%\Netease\CloudMusic\webapp91x64\LocalPrefs.json` and unwraps
|
|
9
|
+
`os_crypt.encrypted_key` with **DPAPI** (scope: the current Windows user).
|
|
10
|
+
2. The resulting AES-256-GCM key decrypts the `v10` cookies in the client's SQLite store. Only
|
|
11
|
+
`MUSIC_U` (the login credential) and `__csrf` (write-request token) are used.
|
|
12
|
+
3. Key and cookie copies are written **only** to a system temp directory, deleted immediately, and the
|
|
13
|
+
cookies live in process memory for the lifetime of one command.
|
|
14
|
+
4. Nothing credential-related is persisted: no cookie jar, no token file, no credential logging.
|
|
15
|
+
`NE_DEBUG=1` prints request paths and bodies, never cookies.
|
|
16
|
+
|
|
17
|
+
Every command re-derives the key (~1 second) by design. Do not "optimize" this into a disk cache.
|
|
18
|
+
|
|
19
|
+
## Network
|
|
20
|
+
|
|
21
|
+
Requests go only to `music.163.com` (weapi and plaintext playlist/song endpoints). No other host is
|
|
22
|
+
contacted and no telemetry is sent. Downloads use the official
|
|
23
|
+
`weapi/song/enhance/download/url/v1` endpoint and save the raw mp3 to the folder you name.
|
|
24
|
+
|
|
25
|
+
## Scope of writes
|
|
26
|
+
|
|
27
|
+
- Local: files downloaded under `--out` (default `%USERPROFILE%\CloudMusic\<playlist name>`).
|
|
28
|
+
- Remote: playlists **you name explicitly** — `create`, `add`, `remove`, `rename`, `desc`, `privacy`,
|
|
29
|
+
`delete`, and `import-mbp` / `--sync` (which rebuilds the named playlist in place). Use
|
|
30
|
+
`import-mbp --dry-run` to preview before anything is written.
|
|
31
|
+
|
|
32
|
+
## Threat model
|
|
33
|
+
|
|
34
|
+
- **DPAPI is user-scoped**: decryption works only for the same Windows user that is logged in to the
|
|
35
|
+
client. Running `dsh` as another user or elevated fails by design.
|
|
36
|
+
- **Your client directory is a credential**: whoever can read `%LOCALAPPDATA%\Netease` under your
|
|
37
|
+
account can act as you on NetEase. Protect it with normal file permissions and the Windows password.
|
|
38
|
+
- **Forks are not covered**: a modified copy of this skill can read those cookies and send them
|
|
39
|
+
anywhere. Trust the canonical repository (`github.com/chenhao6682108/dsh-skill-netease-playlist`) and
|
|
40
|
+
the npm package built from it; check the source of anything else before running it.
|
|
41
|
+
|
|
42
|
+
## Requirements it enforces
|
|
43
|
+
|
|
44
|
+
`scripts\ne-ensure.ps1` guarantees **Node ≥ 22.5** with a usable `node:sqlite` before the CLI runs,
|
|
45
|
+
and only falls back to `winget install OpenJS.NodeJS.LTS` when no suitable Node exists. The skill
|
|
46
|
+
itself is zero-dependency: it imports Node built-ins only.
|
|
47
|
+
|
|
48
|
+
## Reporting a vulnerability
|
|
49
|
+
|
|
50
|
+
Please report privately, not in a public issue:
|
|
51
|
+
|
|
52
|
+
- GitHub → this repository → **Security** tab → *Report a vulnerability*, or
|
|
53
|
+
- email `13714251547@163.com`.
|
|
54
|
+
|
|
55
|
+
Include the plugin version and reproduction steps.
|
|
56
|
+
|
|
57
|
+
## Supported versions
|
|
58
|
+
|
|
59
|
+
Only the latest published version receives security fixes.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chenhao6682108/dsh-skill-netease-playlist",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "NetEase Cloud Music playlist toolkit as a DSH skill plugin: reuse the local desktop client's login state to search tracks, create and edit playlists, add or reorder tracks, delete playlists, download playlist audio as mp3, and bulk-import MusicBee .mbp playlists into the cloud. Windows and a logged-in NetEase Cloud Music client required.",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "NetEase Cloud Music playlist toolkit as a DSH skill plugin: reuse the local desktop client's login state to search tracks, create and edit playlists, add or reorder tracks, delete playlists, download playlist audio as mp3, and bulk-import MusicBee .mbp playlists into the cloud. Ships ne-ensure to install Node LTS when node:sqlite is unavailable. Windows and a logged-in NetEase Cloud Music client required.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek",
|
|
7
7
|
"harness",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"cordis.patch.yml",
|
|
29
29
|
"README.md",
|
|
30
30
|
"README.zh.md",
|
|
31
|
+
"SECURITY.md",
|
|
31
32
|
"LICENSE"
|
|
32
33
|
],
|
|
33
34
|
"engines": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: netease-playlist
|
|
3
|
-
description: 🎧 网易云歌单助手 — 复用本机网易云音乐客户端的登录态(DPAPI 解出 CEF cookie),在网易云上搜索曲目、新建歌单、改名/改简介/改隐私(公开可被收藏 / 私密仅自己可见)、批量加歌按指定顺序、移歌、删歌单、下载歌单歌曲到本地 mp3(320k,断点续传),以及把 MusicBee 的 .mbp 歌单批量搬上云端(解析二进制歌单+读音频标签→自动搜索匹配打分→建歌单按原顺序加歌→复核;本地歌单改过之后可用 --sync 原地清空重建、把云端对齐到最新曲目与顺序)。无需扫码登录,不落盘保存 cookie。| NetEase Cloud Music playlist toolkit — reuses the local desktop client's login state (DPAPI-decrypted CEF cookie) to search tracks, create/rename/describe/private-or-public playlists, reorder, trim, delete playlists, download playlist tracks as local mp3, bulk-import MusicBee .mbp playlists (parse + tag read + fuzzy match + ordered add + verify), and re-sync an imported playlist after the local .mbp changed (in-place rebuild that also fixes order). Windows only: requires the NetEase Cloud Music desktop client installed and logged in as the same Windows user. 仅 Windows
|
|
3
|
+
description: 🎧 网易云歌单助手 — 复用本机网易云音乐客户端的登录态(DPAPI 解出 CEF cookie),在网易云上搜索曲目、新建歌单、改名/改简介/改隐私(公开可被收藏 / 私密仅自己可见)、批量加歌按指定顺序、移歌、删歌单、下载歌单歌曲到本地 mp3(320k,断点续传),以及把 MusicBee 的 .mbp 歌单批量搬上云端(解析二进制歌单+读音频标签→自动搜索匹配打分→建歌单按原顺序加歌→复核;本地歌单改过之后可用 --sync 原地清空重建、把云端对齐到最新曲目与顺序)。无需扫码登录,不落盘保存 cookie。| NetEase Cloud Music playlist toolkit — reuses the local desktop client's login state (DPAPI-decrypted CEF cookie) to search tracks, create/rename/describe/private-or-public playlists, reorder, trim, delete playlists, download playlist tracks as local mp3, bulk-import MusicBee .mbp playlists (parse + tag read + fuzzy match + ordered add + verify), and re-sync an imported playlist after the local .mbp changed (in-place rebuild that also fixes order). Windows only: requires the NetEase Cloud Music desktop client installed and logged in as the same Windows user. 仅 Windows;需本机网易云音乐客户端已登录;缺 Node 会自动安装。
|
|
4
4
|
triggers:
|
|
5
5
|
- 网易云
|
|
6
6
|
- 网易云歌单
|
|
@@ -40,6 +40,20 @@ CLI 入口:`scripts/ne.cmd`(Windows,内部调用 `node scripts/ne.mjs`,
|
|
|
40
40
|
|
|
41
41
|
---
|
|
42
42
|
|
|
43
|
+
## 零、前置条件(一次性)
|
|
44
|
+
|
|
45
|
+
| # | 条件 | 说明 |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| 1 | **Windows** + **已安装并登录网易云音乐桌面客户端** | 登录态从客户端 CEF 存储读出;DPAPI 只在**同一个 Windows 用户**下能解,所以运行 `dsh` 的用户必须与登录客户端的用户一致 |
|
|
48
|
+
| 2 | **Node ≥ 22.5**(CLI 用内置 `node:sqlite` 读 cookie 库) | `ne.cmd` 启动前会跑 `ne-ensure.ps1` 自检:找不到可用 Node 时尝试 `winget install OpenJS.NodeJS.LTS`,成功后自动用它(不依赖刷新 PATH) |
|
|
49
|
+
| 3 | 网络可达 `music.163.com` | 所有云端操作都走 weapi/明文接口 |
|
|
50
|
+
| 4 | 插件已装进 profile 并**重启过 dsh** | `dsh plugin --profile web add @chenhao6682108/dsh-skill-netease-playlist`,然后重启 `dsh web` |
|
|
51
|
+
| 5 | 可选:**MusicBee**(仅 `ne import-mbp` 需要) | 读 `<库>\Playlists` 下的 `.mbp`;这部分也可以交给 `musicbee` 插件 |
|
|
52
|
+
|
|
53
|
+
不满足 1 或 2,所有命令都跑不起来;3 决定能不能联网;5 只影响 `.mbp` 导入。
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
43
57
|
## 一、命令一览
|
|
44
58
|
|
|
45
59
|
| 命令 | 作用 |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
none
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
C:\Program Files\nodejs\node.exe
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# ne-ensure.ps1 - guarantee Node >= 22.5 (with a usable node:sqlite) for the NetEase CLI.
|
|
2
|
+
#
|
|
3
|
+
# Writes two small files next to this script so ne.cmd can launch the right binary
|
|
4
|
+
# without depending on a freshly refreshed PATH:
|
|
5
|
+
# .node-path.txt absolute path of the chosen node.exe
|
|
6
|
+
# .node-flag.txt an extra flag (--experimental-sqlite) or the word none
|
|
7
|
+
#
|
|
8
|
+
# ASCII-only on purpose: Windows PowerShell 5.1 decodes BOM-less UTF-8 as ANSI.
|
|
9
|
+
param(
|
|
10
|
+
[switch]$Quiet
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
$ErrorActionPreference = 'Continue'
|
|
14
|
+
$dir = $PSScriptRoot
|
|
15
|
+
$min = [version]'22.5.0'
|
|
16
|
+
|
|
17
|
+
function Say($msg) {
|
|
18
|
+
if (-not $Quiet) { Write-Host ('[ne-ensure] ' + $msg) }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function Find-Node {
|
|
22
|
+
$list = @()
|
|
23
|
+
$c = Get-Command node -ErrorAction SilentlyContinue
|
|
24
|
+
if ($c) { $list += $c.Source }
|
|
25
|
+
if ($env:ProgramFiles) { $list += (Join-Path $env:ProgramFiles 'nodejs\node.exe') }
|
|
26
|
+
if ($env:LOCALAPPDATA) { $list += (Join-Path $env:LOCALAPPDATA 'Programs\nodejs\node.exe') }
|
|
27
|
+
return ($list | Where-Object { $_ -and (Test-Path $_) } | Select-Object -Unique)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function NodeVersion($exe) {
|
|
31
|
+
try {
|
|
32
|
+
$v = (& $exe -v 2>&1 | Out-String).Trim()
|
|
33
|
+
if ($v -match '^v(\d+)\.(\d+)\.(\d+)') { return [version]("$($Matches[1]).$($Matches[2]).$($Matches[3])") }
|
|
34
|
+
} catch { }
|
|
35
|
+
return $null
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function SqliteFlag($exe) {
|
|
39
|
+
try {
|
|
40
|
+
& $exe -e "require('node:sqlite')" 2>&1 | Out-Null
|
|
41
|
+
if ($LASTEXITCODE -eq 0) { return '' }
|
|
42
|
+
} catch { }
|
|
43
|
+
try {
|
|
44
|
+
& $exe --experimental-sqlite -e "require('node:sqlite')" 2>&1 | Out-Null
|
|
45
|
+
if ($LASTEXITCODE -eq 0) { return '--experimental-sqlite' }
|
|
46
|
+
} catch { }
|
|
47
|
+
return $null
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
$chosen = $null
|
|
51
|
+
$flag = $null
|
|
52
|
+
|
|
53
|
+
foreach ($exe in (Find-Node)) {
|
|
54
|
+
$v = NodeVersion $exe
|
|
55
|
+
if ($v -and $v -ge $min) {
|
|
56
|
+
$f = SqliteFlag $exe
|
|
57
|
+
if ($null -ne $f) { $chosen = $exe; $flag = $f; break }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (-not $chosen -and (Get-Command winget -ErrorAction SilentlyContinue)) {
|
|
62
|
+
Say 'no Node >= 22.5 with node:sqlite found; trying winget install OpenJS.NodeJS.LTS (a UAC prompt may appear)'
|
|
63
|
+
& winget install --id OpenJS.NodeJS.LTS -e --source winget --accept-package-agreements --accept-source-agreements --silent 2>&1 | Out-Null
|
|
64
|
+
Start-Sleep -Seconds 3
|
|
65
|
+
foreach ($exe in (Find-Node)) {
|
|
66
|
+
$v = NodeVersion $exe
|
|
67
|
+
if ($v -and $v -ge $min) {
|
|
68
|
+
$f = SqliteFlag $exe
|
|
69
|
+
if ($null -ne $f) { $chosen = $exe; $flag = $f; break }
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (-not $chosen) {
|
|
75
|
+
Write-Host ''
|
|
76
|
+
Write-Host 'ERROR: the NetEase skill needs Node >= 22.5 with node:sqlite.'
|
|
77
|
+
Write-Host ' 1) install Node LTS https://nodejs.org/ (or: winget install OpenJS.NodeJS.LTS)'
|
|
78
|
+
Write-Host ' 2) reopen your terminal so PATH picks it up, then run the command again'
|
|
79
|
+
exit 1
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
Set-Content -Path (Join-Path $dir '.node-path.txt') -Value $chosen -Encoding ASCII
|
|
83
|
+
Set-Content -Path (Join-Path $dir '.node-flag.txt') -Value $(if ($flag) { $flag } else { 'none' }) -Encoding ASCII
|
|
84
|
+
|
|
85
|
+
Say ('ready: ' + $chosen + ' node ' + (NodeVersion $chosen) + ' sqlite flag: ' + $(if ($flag) { $flag } else { 'none' }))
|
|
86
|
+
exit 0
|
|
@@ -1,3 +1,25 @@
|
|
|
1
1
|
@echo off
|
|
2
2
|
setlocal
|
|
3
|
-
|
|
3
|
+
set "DIR=%~dp0"
|
|
4
|
+
|
|
5
|
+
rem --- 1) make sure Node >= 22.5 with node:sqlite is available (installs what is missing) ---
|
|
6
|
+
powershell -NoProfile -ExecutionPolicy Bypass -File "%DIR%ne-ensure.ps1" -Quiet >nul 2>&1
|
|
7
|
+
if errorlevel 1 (
|
|
8
|
+
powershell -NoProfile -ExecutionPolicy Bypass -File "%DIR%ne-ensure.ps1"
|
|
9
|
+
exit /b 1
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
rem --- 2) launch the node binary ne-ensure picked (PATH in this console may be stale) ---
|
|
13
|
+
set "NODEEXE="
|
|
14
|
+
set "NEFLAG="
|
|
15
|
+
for /f "usebackq delims=" %%L in ("%DIR%.node-path.txt") do set "NODEEXE=%%L"
|
|
16
|
+
for /f "usebackq delims=" %%L in ("%DIR%.node-flag.txt") do set "NEFLAG=%%L"
|
|
17
|
+
if /i "%NEFLAG%"=="none" set "NEFLAG="
|
|
18
|
+
|
|
19
|
+
if not defined NODEEXE (
|
|
20
|
+
echo [ne] could not read %DIR%.node-path.txt - run ne-ensure.ps1 manually
|
|
21
|
+
exit /b 1
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
"%NODEEXE%" %NEFLAG% --disable-warning=ExperimentalWarning "%DIR%ne.mjs" %*
|
|
25
|
+
endlocal
|