Repository navigation
MCP:AI 工具能搜视频,能读自己的 B站收藏、关注和历史 - #455
Merged
Merged
Conversation
扩展后台新增 search 方法(agent-search.js),B站走分拣台的 WBI 签名通道,YouTube 读搜索结果页的 ytInitialData;一次只搜一个、两次至少隔 2 秒,412/429 回 THROTTLED。MCP 指令改成先 search_videos 再 get_video;AGENT.md、mcp/README、skill、隐私说明和设置页提示同步。
新增 get_favorites、get_follows、get_history 三个工具,对应扩展的 favorites、follows、history 方法(agent-mydata.js)。收藏带分拣台的标签、备注、AI 判断和一句话总结;稍后再看是 id 为 toview 的收藏夹。勾选过的收藏夹和同步过的关注读本地那份,其余每次从 B站 读一页,一次只跑一个,只发 GET。 设置页「允许 MCP 连接」下面加从属开关「允许 AI 工具读我的收藏、关注和历史」:MCP 关着时变灰,保留自己的值;关着时这三个方法返回 PERSONAL_DATA_OFF。triage-bg.js 的收藏和稍后再看条目映射抽成 triageFavItem / triageToviewItem 共用。
Merged
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.
MCP 加四个工具。
search_videos在用户浏览器里搜 B站和 YouTube,返回 BV 号或视频 ID、时长、播放量和 UP 主,拿到就能接get_video。搜索一次一个,间隔至少 2 秒,YouTube 只取第一页,被 412/429 就报 THROTTLED。get_favorites、get_follows、get_history只读用户自己的收藏夹(带分拣台的标签和备注)、关注和观看历史。设置页新开关「读我的收藏、关注和历史」默认关,是「允许 MCP 连接」的子开关:MCP 关着时变灰,自己的值保留。没开时返回 PERSONAL_DATA_OFF,没登录返回 NOT_LOGGED_IN。三个工具一次一个、间隔 1 秒,服务端已放弃等待的调用不再请求 B站。分拣台勾选的收藏夹读本地副本,能按标签、备注和摘要搜;其他收藏夹读 B站 一页。为了复用分拣台的条目格式,triage-bg.js抽出了triageFavItem和triageToviewItem。MCP 的说明和skills/moondigest都改成先用search_videos找视频,并写了用户问自己的收藏、关注、历史时用哪三个工具。验证:
mcp测试 17 个通过,node scripts/selftest.mjs43 个通过。在 ego lite 里用真实 B站登录态端到端调了四个工具,结果正确,顺手修了签名带换行把「一个 UP 一行」打乱的问题。设置页的开关联动在 ego 里点过。另开干净上下文的 Claude 对比有无 MCP:找 Rust 所有权视频那题,没有 MCP 拿不到字幕、20 轮没完成,有 MCP 6 轮读了 5 份字幕给出带时间点的答案;问收藏夹那题,没有 MCP 做不了。最后一个提交是审 diff 后的修复(调用间隔、超时、取消勾选的收藏夹、文集历史的 cursor、带关键词时不报总数),只有自测覆盖,没再进 ego 真测。没测到:分拣台本地勾选过、带标签的收藏夹,以及真实的 412/429 响应。