Repository navigation
Conversation
- 分享页挂载点同时匹配新版顶部工具栏与底部操作栏,按钮沿用原生样式 - 新增 getShareSelectedList 读取新版列表勾选状态与 locals.file_list - getShareData 兼容新版 locals / 带前缀 1 的提取码键名 / BDCLND - 修正 tplconfig 请求中的 $bdstoken 拼接错误,优先使用页面提供的签名 - 分享页与主页取链:错误响应不再崩溃、不再缓存失败结果,并给出可读提示 - 「保存后下载」点击新版保存按钮本身;令牌请求失败不再显示 [object Object] 关联:hmjz100#537 hmjz100#532 hmjz100#489 hmjz100#468 hmjz100#539 hmjz100#510 hmjz100#519 hmjz100#484 hmjz100#502 hmjz100#477 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
问题
百度网盘分享页已全面切换到新版
disk-share-v2(Vue 3),脚本仍按旧版 DOM 适配,导致分享页的「下载助手」完全不可用(#537、#532、#489、#468 均为同一根因):.module-share-top-bar .x-button-box .g-dropdown-button.tools-more已不存在,按钮(含「点我点亮」)不再出现;getSelectedList()读不到新版列表.JS-list-view-item的勾选状态,提示「请勾选要下载的文件哦~」;getShareData()读不到新版的提取码(localStorage 键名带前缀1)、sekey、bdstoken等;getShareSign的拼接写成了$bdstoken=(缺&),签名请求必然失败;.tools-share-save-hb,新版里它只是按钮外层的 div,点了没反应。另外几处相关的健壮性问题一并处理:
getShareFilesUrl在服务器返回错误(113/118)或加密list字符串时,仍把失败结果写进 4 小时直链缓存([错误报告] 百度网盘分享页 getShareFilesUrl:错误分支缺 early-return,失败结果仍写入 4 小时直链缓存(响应无 list 字段时直接崩溃) #510、[错误报告] 请修改我为您的问题,百度网盘获取下载地址失败,服务器说:113。 #539 的根因之一);getFilesUrl错误分支之后仍会执行res.list.length,服务器返回错误时整批中断([错误报告] 百度网盘主页 getFilesUrl:错误分支仍会落到 res.list.length,服务器返回错误时整批中断(775f028 修复了 find 但漏了 length) #519);非常规错误:[object Object]([错误报告] 百度網盤獲取直鏈錯誤 #484);修改内容
mount.share同时匹配旧版顶部栏、新版多文件列表工具栏.share-multi-list-toolbar-row .share-list-toolbar、新版底部操作栏.module-share-bottom-bar .x-button-box(单文件分享页);createShareButton():复制原生按钮的data-v-*作用域属性来沿用网盘自身样式,多文件页注入到顶部「下载 / 保存至网盘」胶囊旁,单文件页注入到底部操作栏,菜单在底部时向上展开且与按钮无间隙(鼠标移动时不会消失);addInitButton()的「点我点亮」同样适配;getShareSelectedList():从.JS-list-view-item[data-file-key]的.wp-checkbox--checked读取勾选,文件信息来自页面提供的window.locals.dump().file_list(进入子文件夹后页面会同步更新该列表,已验证);单文件分享页直接返回页面中的文件;getShareData()兼容locals.dump()/locals.get()/yunData,提取码兼容1<surl>_pwd,sekey依次取currentSekey/locals/BDCLNDCookie;页面已提供sign/timestamp时直接使用,否则再请求tplconfig(修正$bdstoken为&bdstoken,并兼容data.sign包裹);getShareFilesUrl():只缓存成功获取到的地址;113/118、加密list、-20(需人机验证)、9013(账号受限)分别给出明确提示;jsToken为空时不再拼接jsToken=undefined;getFilesUrl():错误响应不再触发res.list.length崩溃;服务器未返回的文件给出明确提示;.tools-share-save-hb内的真实按钮;测试
用 Playwright 无头 Chromium 加载真实分享页(2026-11-04 线上的
disk-share-v2),通过 GM_* 兼容层注入本脚本,分别在未登录与已登录(真实账号 Cookie)状态下验证:share/tplconfig(&bdstoken修正后 errno 0)与api/sharedownload(errno 0,明文list),弹窗正常显示该文件与「增强下载 / 直接下载 / 推送至 IDM / 复制地址」按钮;拿到的d.pcs.baidu.com直链用Range: bytes=0-0请求返回 HTTP 206;sharedownload返回加密list字符串时显示「服务器只返回了加密的下载信息…需要保存到网盘后下载」的提示,且不再写入直链缓存;node --check通过;npx eslint与 dev 分支一致(仅原有 2 条 unused-vars 警告)。说明
.github/contributing.md,未修改脚本版本号,目标分支为dev;只改动(改)网盘直链下载助手.user.js。关联议题:#537 #532 #489 #468 #539 #510 #519 #484 #502 #477
🤖 Generated with Claude Code