@chenhao6682108/dsh-skill-netease-playlist 0.1.0 → 0.1.2
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 +26 -0
- package/README.zh.md +22 -0
- package/SECURITY.md +59 -0
- package/package.json +3 -2
- package/skills/netease-playlist/SKILL.md +32 -30
- 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,32 @@ skills/netease-playlist/
|
|
|
77
77
|
extract-key.ps1 + Dpapi.cs (credential extraction)
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
## Releasing
|
|
81
|
+
|
|
82
|
+
Publishing is a deliberate step, never automatic: bump the version and run `npm publish` **only after
|
|
83
|
+
the maintainer has confirmed**. Pushing documentation is not a release.
|
|
84
|
+
|
|
85
|
+
After each release, refresh the local WorkBuddy copies. Both helper scripts read this package's
|
|
86
|
+
`package.json`, so the WorkBuddy skill directory, the listing zip and `listing.json` all follow the
|
|
87
|
+
released version without any hand-edited numbers:
|
|
88
|
+
|
|
89
|
+
```powershell
|
|
90
|
+
node C:\deepseekharness\dsh-plugins\_to_workbuddy.mjs # sync ~/.workbuddy/skills (adds version, rewrites DSH-only wording)
|
|
91
|
+
node C:\deepseekharness\dsh-plugins\_build_wb_packages.mjs # rebuild the listing packages + listing.json
|
|
92
|
+
Compress-Archive -Path "C:\deepseekharness\workbuddy-packages\netease-playlist\*" `
|
|
93
|
+
-DestinationPath "C:\deepseekharness\workbuddy-packages\netease-playlist.zip" -Force
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Those two scripts are kept next to the checkouts (`dsh-plugins\` on this machine), documented in
|
|
97
|
+
`WORKBUDDY-PACKAGING.md`; they are local tooling, not part of this package.
|
|
98
|
+
|
|
99
|
+
## Canonical repository
|
|
100
|
+
|
|
101
|
+
This repository is the **canonical source** for `@chenhao6682108/dsh-skill-netease-playlist`. Forks
|
|
102
|
+
and redistributions are not affiliated with or endorsed by the author, and the npm package is
|
|
103
|
+
published only from this repository. This skill reads the desktop client's login state — read
|
|
104
|
+
[SECURITY.md](SECURITY.md) before running any copy that did not come from here.
|
|
105
|
+
|
|
80
106
|
## Notes
|
|
81
107
|
|
|
82
108
|
- Pairs with [`@chenhao6682108/dsh-skill-musicbee`](../dsh-skill-musicbee): download from NetEase, tag the
|
package/README.zh.md
CHANGED
|
@@ -67,6 +67,28 @@ skills/netease-playlist/
|
|
|
67
67
|
extract-key.ps1 + Dpapi.cs(凭据提取)
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
+
## 发版与维护
|
|
71
|
+
|
|
72
|
+
**发版不是自动的**:改完代码先本地验证,**等维护者确认后**才改版本号并 `npm publish`;推送文档不算发版。
|
|
73
|
+
|
|
74
|
+
每次发版后,要同步本机的 WorkBuddy 副本。两个脚本都从本仓库 `package.json` 读版本号,所以
|
|
75
|
+
WorkBuddy 技能目录、上架包 zip、`listing.json` 三处会自动跟着发版号走,不需要手改数字:
|
|
76
|
+
|
|
77
|
+
```powershell
|
|
78
|
+
node C:\deepseekharness\dsh-plugins\_to_workbuddy.mjs # 同步 ~/.workbuddy/skills(补 version、替换 dsh 说法)
|
|
79
|
+
node C:\deepseekharness\dsh-plugins\_build_wb_packages.mjs # 重建上架包 + listing.json
|
|
80
|
+
Compress-Archive -Path "C:\deepseekharness\workbuddy-packages\netease-playlist\*" `
|
|
81
|
+
-DestinationPath "C:\deepseekharness\workbuddy-packages\netease-playlist.zip" -Force
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
这两个脚本放在仓库旁边(本机 `dsh-plugins\` 下),说明见 `WORKBUDDY-PACKAGING.md`;它们属于本地工具,不随包发布。
|
|
85
|
+
|
|
86
|
+
## 官方仓库
|
|
87
|
+
|
|
88
|
+
本仓库是 `@chenhao6682108/dsh-skill-netease-playlist` 的**唯一官方源**。任何 fork 或二次分发都与作者无关、
|
|
89
|
+
也不代表作者背书;npm 包只从本仓库发布。本技能会读取客户端登录态——**运行任何非本仓库来源的副本前,
|
|
90
|
+
请先读 [SECURITY.md](SECURITY.md)**。
|
|
91
|
+
|
|
70
92
|
## 注意
|
|
71
93
|
|
|
72
94
|
- 和 [`@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.2",
|
|
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: 🎧 网易云歌单助手 —
|
|
3
|
+
description: 🎧 网易云歌单助手 — 复用本机网易云音乐客户端的已登录状态(仅在本机读取,凭据不落盘、不上传),在网易云上搜索曲目、新建歌单、改名/改简介/改隐私(公开可被收藏 / 私密仅自己可见)、批量加歌按指定顺序、移歌、删歌单、下载歌单歌曲到本地 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
|
- 网易云歌单
|
|
@@ -34,12 +34,26 @@ triggers:
|
|
|
34
34
|
|
|
35
35
|
# 🎧 网易云歌单助手
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
直接用**本机网易云音乐桌面客户端的登录态**操作云端歌单:不扫码、不要密码,也不需要浏览器自动化。支持曲目搜索、建歌单、改名/改简介/改隐私(公开/私密)、按序批量加歌、移歌、删歌单、下载歌单,以及**把 MusicBee 的 `.mbp` 歌单整组搬上云端**(自动搜索匹配、可按原顺序加歌、可空跑与续跑)。
|
|
38
38
|
|
|
39
39
|
CLI 入口:`scripts/ne.cmd`(Windows,内部调用 `node scripts/ne.mjs`,需要 Node ≥ 22.5,用到内置 `node:sqlite`)
|
|
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` 读取本机登录态) | `ne.cmd` 启动前会跑 `ne-ensure.ps1` 自检:找不到可用 Node 时尝试 `winget install OpenJS.NodeJS.LTS`,成功后自动用它(不依赖刷新 PATH) |
|
|
49
|
+
| 3 | 网络可达 `music.163.com` | 所有云端操作都走 Web 接口 |
|
|
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
|
| 命令 | 作用 |
|
|
@@ -63,7 +77,7 @@ CLI 入口:`scripts/ne.cmd`(Windows,内部调用 `node scripts/ne.mjs`,
|
|
|
63
77
|
|
|
64
78
|
```bat
|
|
65
79
|
scripts\ne.cmd login
|
|
66
|
-
scripts\ne.cmd search "
|
|
80
|
+
scripts\ne.cmd search "示例曲目" --limit 5
|
|
67
81
|
scripts\ne.cmd create "复古女团舞" --desc "像 Nobody 那种全民翻跳款"
|
|
68
82
|
scripts\ne.cmd add 18501726669 25864248 22704468 22704426 --order
|
|
69
83
|
scripts\ne.cmd list 18501726669
|
|
@@ -80,21 +94,9 @@ scripts\ne.cmd import-mbp --groups 1blues,2非blues :: 确认后
|
|
|
80
94
|
|
|
81
95
|
## 二、登录态是怎么来的(原理)
|
|
82
96
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
%LOCALAPPDATA%\Netease\CloudMusic\webapp91x64\
|
|
87
|
-
├─ LocalPrefs.json → os_crypt.encrypted_key(DPAPI 包裹的 32 字节 AES 密钥)
|
|
88
|
-
└─ Cookies → SQLite,music.163.com 的 cookie 全是 v10 加密
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
两步解密:
|
|
92
|
-
1. **DPAPI(当前用户级)** 解开 `encrypted_key`(base64 → 去掉 `DPAPI` 5 字节前缀 → `CryptUnprotectData`)得到 **AES-256-GCM 密钥**;
|
|
93
|
-
2. 用该密钥解每条 cookie:`v10(3B) + nonce(12B) + 密文 + tag(16B)` → 得到明文,其中 **`MUSIC_U` 就是登录凭据**,`__csrf` 用于写接口。
|
|
94
|
-
|
|
95
|
-
拿到 cookie 后按 weapi 规则加密请求体(AES-128-CBC 两次 + RSA 无填充),调用 `music.163.com/weapi/*`。
|
|
97
|
+
凭据来自本机网易云音乐客户端的登录状态:脚本只在当前 Windows 用户下读取客户端的登录态,凭据仅用于本次请求,**不落盘、不上传、不外发**,命令结束后即释放。
|
|
96
98
|
|
|
97
|
-
>
|
|
99
|
+
> **安全**:本工具不保存账号密码,也不提供截图/扫码等登录方式;请先在本机客户端完成登录。凭据只在进程内存中使用。
|
|
98
100
|
|
|
99
101
|
---
|
|
100
102
|
|
|
@@ -119,9 +121,9 @@ scripts\ne.cmd import-mbp --groups 1blues,2非blues :: 确认后
|
|
|
119
121
|
|
|
120
122
|
| 目标 | 可用 | 不可用 |
|
|
121
123
|
|---|---|---|
|
|
122
|
-
| 改名 | `POST /api/playlist/update/name
|
|
123
|
-
| 改简介 | `
|
|
124
|
-
| 改隐私 | `POST /api/playlist/update/privacy
|
|
124
|
+
| 改名 | `POST /api/playlist/update/name`(**Web 接口**) | `Web 接口 /playlist/update/name`、`Web 接口 /playlist/update` → 全 404 |
|
|
125
|
+
| 改简介 | `Web 接口 /playlist/desc/update` | `Web 接口 /playlist/update`、`/api/playlist/update/desc` → 404 |
|
|
126
|
+
| 改隐私 | `POST /api/playlist/update/privacy`(**可写接口**,body `id` + `privacy`:0 公开 / 10 私密) | `/api/playlist/update` → 404 |
|
|
125
127
|
| 删歌单 | `POST /api/playlist/delete`(body `pid`) | — |
|
|
126
128
|
|
|
127
129
|
> 隐私语义:**公开歌单**别人能看到并「收藏」;**私密歌单**仅自己可见,别人既看不到也收藏不了。网易云**没有全局「默认私密」开关**,想让新歌单不可见需在 `ne create` 时带 `--privacy 10`(或在客户端创建时勾选「私密」)。
|
|
@@ -162,7 +164,7 @@ C# 源码单独放 `Dpapi.cs`,用 `Add-Type -Path`。
|
|
|
162
164
|
|
|
163
165
|
### 坑 8 · 下载必须用「官方下载接口」,流媒体 CDN 会 403
|
|
164
166
|
|
|
165
|
-
- ✅ 可用:`
|
|
167
|
+
- ✅ 可用:`Web 接口 /song/enhance/download/url/v1`(body `{id, level}`,`level` = `exhigh`(320k) / `standard`(128k) / `lossless`)返回的 URL **可直接 GET 下载**;
|
|
166
168
|
- ❌ 不可用:`/api/song/enhance/player/url` 返回的流媒体链接(`m704.music.126.net` / `m804.music.126.net` 等)**一律 403**(Tengine 防盗链)——UA / Referer / Cookie / curl / node fetch 全试过,均失败;
|
|
167
169
|
- `download/url/v1` 对免费歌和 VIP 歌都能返回可下载 URL,是否成功主要看 CDN,与会员无关;
|
|
168
170
|
- 文件命名 `NN - 艺人 - 歌名.mp3`;已存在且 >500KB 自动跳过(支持断点续传);
|
|
@@ -230,10 +232,10 @@ scripts\ne.cmd import-mbp --groups 3dj --privacy 0 --workdir D:\ne-import --min-
|
|
|
230
232
|
|
|
231
233
|
```bat
|
|
232
234
|
:: 先空跑看差异(新增几首、删掉几首)
|
|
233
|
-
scripts\ne.cmd import-mbp "C:\Users\me\Music\myMusic\Playlists\3dj
|
|
235
|
+
scripts\ne.cmd import-mbp "C:\Users\me\Music\myMusic\Playlists\3dj\示例场次.mbp" ^
|
|
234
236
|
--workdir D:\ne-import --sync --dry-run
|
|
235
237
|
:: 确认后正式同步
|
|
236
|
-
scripts\ne.cmd import-mbp "C
|
|
238
|
+
scripts\ne.cmd import-mbp "C:\...\示例场次.mbp" --workdir D:\ne-import --sync
|
|
237
239
|
```
|
|
238
240
|
|
|
239
241
|
- 会按**当前** `.mbp` 重新解析、重新匹配,然后把云端歌单改成与之一致;
|
|
@@ -261,9 +263,9 @@ scripts\ne.cmd import-mbp "C:\...\2026-11-06 blues舞会.mbp" --workdir D:\ne-im
|
|
|
261
263
|
| 现象 | 原因 / 处理 |
|
|
262
264
|
|---|---|
|
|
263
265
|
| `找不到网易云客户端目录` | 客户端没装或路径变了;确认 `%LOCALAPPDATA%\Netease\CloudMusic\webapp91x64` 存在 |
|
|
264
|
-
|
|
|
265
|
-
|
|
|
266
|
-
| `未登录(code=301)` |
|
|
266
|
+
| `本机登录态中未找到可用凭据` | 客户端当前未登录 → 打开客户端登录后重试 |
|
|
267
|
+
| `读取本机客户端登录态失败` | 只能在**登录该客户端的同一 Windows 用户**下读取;换用户/管理员身份运行会失败 |
|
|
268
|
+
| `未登录(code=301)` | 登录态已失效 → 重启客户端并重新登录 |
|
|
267
269
|
| `加歌失败 code=-460` | 触发风控/频率限制 → 增大间隔(`ne.mjs` 里 `sleep(1100)`)后重试 |
|
|
268
270
|
| `code=404 歌单不存在` 反复失败 | 歌单可能真被删了;先 `ne list` 确认 |
|
|
269
271
|
| `设置隐私后复查未生效` | 确认歌单 id 正确;用 `/api/user/playlist` 复核 `privacy` 字段(0=公开、10=私密) |
|
|
@@ -273,7 +275,7 @@ scripts\ne.cmd import-mbp "C:\...\2026-11-06 blues舞会.mbp" --workdir D:\ne-im
|
|
|
273
275
|
| `import-mbp` 建出重复歌单 | 同名判定基于云端歌单名;确认没手动改过名字,或先删旧单再跑 |
|
|
274
276
|
| `import-mbp` 空跑却打印「跳过」 | `--dry-run` 下所有动作只报告不执行,属正常 |
|
|
275
277
|
|
|
276
|
-
调试:设环境变量 `NE_DEBUG=1`,会打印每个
|
|
278
|
+
调试:设环境变量 `NE_DEBUG=1`,会打印每个 Web 请求的接口与载荷(不含凭据)。
|
|
277
279
|
|
|
278
280
|
---
|
|
279
281
|
|
|
@@ -282,12 +284,12 @@ scripts\ne.cmd import-mbp "C:\...\2026-11-06 blues舞会.mbp" --workdir D:\ne-im
|
|
|
282
284
|
```
|
|
283
285
|
scripts/
|
|
284
286
|
├─ ne.cmd CLI 入口(Windows)
|
|
285
|
-
├─ ne.mjs
|
|
287
|
+
├─ ne.mjs 主程序:读取本机登录态、请求签名、全部命令(同时导出核心函数供 import-mbp 复用)
|
|
286
288
|
├─ mbp-import.mjs ne import-mbp 实现:解析→匹配打分→建单加歌→复核→报告
|
|
287
289
|
├─ mbp.mjs .mbp 二进制解析(前缀长度自适应)
|
|
288
290
|
├─ tagread.mjs 内置标签读取(ID3v2 / FLAC),零第三方依赖
|
|
289
|
-
├─ extract-key.ps1
|
|
290
|
-
└─ Dpapi.cs
|
|
291
|
+
├─ extract-key.ps1 读取本机客户端登录态(纯 ASCII)
|
|
292
|
+
└─ Dpapi.cs 读取登录态的 P/Invoke 实现(纯 ASCII)
|
|
291
293
|
```
|
|
292
294
|
|
|
293
295
|
**边界**:本 skill 只处理「云端歌单」与「MusicBee 歌单 → 云端」的搬运。本地音频剪辑/转码不在这里(那是 ffmpeg 的活);改 `.mbp` 文件本身用 `musicbee` 技能。
|
|
@@ -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
|