适配 xeapi ,补充部分 VIP 图标显示 - #1754
Open
ITManCHINA wants to merge 4 commits into
Open
Conversation
…teaseMusic#1751) Co-authored-by: Takoyaki White <staticwhite999@outlook.com> Signed-off-by: ITManCHINA <1678812512@qq.com>
| for (let index = 0; index < buffer.length; index++) | ||
| masked[index] = buffer[index] ^ pad[index & 0x0f]; | ||
| const encoded = Buffer.from(masked.toString('base64')); | ||
| const rotation = encoded.length ? (pad[0] & 0x0f) % encoded.length : 0; |
Author
|
Oh,看来还要修一修小问题😋 |
ITManCHINA
marked this pull request as draft
August 26, 2026 17:26
Signed-off-by: ITManCHINA <1678812512@qq.com>
ITManCHINA
marked this pull request as ready for review
August 26, 2026 18:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
根据 NeteaseCloudMusicApiEnhanced/api-enhanced 引入部分改动。
改动由 Claude Opus 5 总结。
适配网易云 xeapi 以恢复音源替换,并补充部分 VIP 徽标显示。
背景:新版客户端改用
xeapi加密(POST/xeapi/<path>,体为B/S/R),而hook.js只识别/eapi/与linux/forward,请求完全未进入拦截,音源替换与本地 VIP 一并失效;另外本地 VIP 自 2021 年起只补了会员权益接口,未碰账号接口的profile.vipType,导致界面不显示会员标识。改动
crypto.js:新增xeapi加解密(decryptSession/decryptRequest/encryptRequest);eapi 与 xeapi 共用的响应编解码抽为decryptResponse/encryptResponse,自动识别并保留内层 gzip;AES 密钥长度按实际长度推导以支持 32 字节会话密钥(既有密钥仍为aes-128-ecb)。x-encr-sskey下发会话密钥、客户端后续请求复用,记住即可反解B;已对真实上游验证还原参数与发送值逐字节相同。hook.js:拦截/xeapi/;补全替换后的level/encodeType/time(灰响应留null/0会让播放器拒绝 FLAC);风控码-460/-462时合成占位条目回落音源、成功后回写顶层code;inject守卫空条目并在url缺失时也触发;响应头剥离提前到解析前;applyLocalVip拆为权益与账号两个补丁,后者设profile.vipType;端点协议改为PACKAGE_SCHEME/PLAIN_ENDPOINT_OS配置驱动;新增大小写不敏感setHeader与NETEASE_USER_AGENT/NETEASE_MCONFIG_INFO覆盖。provider/find.js、match.js:歌曲详情改用/api/v3/song/detail、保留旧接口兜底、兼容新旧字段名;match()附带duration。provider/bilivideo.js:安全处理 WBI key、set-cookie、搜索结果及 DASH 音频字段缺失;Bilibili 返回限流/风控错误体时按音源未命中处理,不再因data.result.map抛错;音频缺少base_url时回退到backup_url。provider/bilivideo.test.js:完整保留原有 5 首真实歌曲的上游可用性测试,并在同一文件中新增请求 mock 测试,覆盖正常匹配、搜索错误体和备用音频 URL。向后兼容:所有改动均为新增,未替换或移除任何旧路径。补齐老/新不成对端点:song detail
v1/v2、/api/album、recommendv2/v3、VIPfront/vip/info、账号接口两变体、/api/radio/like。NETEASE_COOKIE保持合并语义(整体替换会丢掉客户端os/appver,破坏平台识别)。验证:回归 17 项 + 风控 7 项全过;真实上游验证了 xeapi 请求构造、会话解封与响应往返;某专辑 10 首灰歌 10/10 替换成功。
yarn jest与 prettier 状态与改动前一致(spawn.test.js为既有平台差异,request.test.js/bilivideo.test.js为联网 flake,已git stash对照确认)。已知限制:xeapi 下载接口不做
pretendPlay(重加密需会话密钥,未建立时直接匹配响应);md5仍为 URL 的 md5(既有行为);profile.vipType取值11/100、登录态 VIP 补丁与真实客户端播放已实测可用,但在 3.1.X 客户端中,VIP 图标状态很快会消失。