健壮 Bangumi Data 匹配与合并工具,修复相关问题#289
Merged
huangxd- merged 11 commits intohuangxd-:mainfrom Apr 30, 2026
Merged
Conversation
|
@wan0ge is attempting to deploy a commit to the huangxd's projects Team on Vercel. A member of the Team first needs to authorize it. |
👷 Deploy request for danmuapi pending review.Visit the deploys page to approve it
|
Added aliases to the data structure and improved title matching logic.
修复开启 Bangumi Data 匹配后弹弹源始终不返回“终末起点 第二季”结果(因为 Bangumi Data 数据这一部使用的是繁体)
lilixu3
pushed a commit
to lilixu3/danmu_api
that referenced
this pull request
Apr 30, 2026
* 修复开启 USE_BANGUMI_DATA 后《加油!中村同学!!》对齐 Bangumi-Data 数据后结果被抛弃 * 命中数据流程进行简繁转换,提升准确度 * Update bahamut.js * bahamut.js:补全 retries: 1 重试参数,避免反代场景的一定风控 * dandan.js:补全 retries: 1 重试参数,避免接口不稳定 * merge-util.js:修复“终末起点”合并问题,并在判断季时深入到别名池 * animeko.js:补全别名传递 * dandan.js:补全别名传递 Added aliases to the data structure and improved title matching logic. * common-util.js:引入繁简转化工具,用于标题匹配路由提升可靠性 修复开启 Bangumi Data 匹配后弹弹源始终不返回“终末起点 第二季”结果(因为 Bangumi Data 数据这一部使用的是繁体) * Update common-util.js * bangumi-data-util.js:精简裁切Bangumi Data 数据结构,大幅减少硬盘与内存占用
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.
📝 PR 描述
变更类型
🐛 Bug 修复 (bug)
🚀 优化/重构 (perf/refactor)
变更内容
本次 PR 主要修复了各源站(Bahamut、Dandan、Animeko)的标题匹配遗漏与别名传递丢失问题,优化了底层的全局匹配引擎,并进一步提升了网络请求的健壮性与本地数据的内存利用率。具体变更如下:
修复 Bahamut 源的标题误杀问题 (
bahamut.js)USE_BANGUMI_DATA时,网络结果成功对齐本地数据后,主标题会被本地优选标题覆盖,导致后续基于用户搜索词的标题匹配规则校验失败,进而错杀有效搜索结果。aliases)中;同时重构过滤阶段的匹配逻辑,利用短路求值特性,在主标题匹配失败时自动降级验证别名池,确保源站特征不丢失。优化 Bangumi Data 检索精度与性能 (
bangumi-data-util.js)searchBangumiData函数新增了搜索词的简繁体转换兜底支持,以实现更高精度的精确匹配。Set对原词、简体词和繁体词进行提前聚合与去重。在遍历数据源时,通过双重some逻辑进行极简的短路碰撞,在提升匹配准确率的同时,保证了遍历操作的性能。优化全局标题匹配引擎,引入简繁双向容错 (
common-util.js)titleMatches)不具备简繁体转换能力。当遇到如“终末起点 第二季”与“終末起點 第二季”这种仅存在简繁字形差异的情况时,无论是包含匹配还是相似度匹配都会因为字符不一致导致评分骤降,引发跨源误杀。qList),让包含匹配与相似度匹配兜底策略共享该词池。在维持原有代码层级与防错逻辑不变的前提下,消除了简繁体匹配的死角。修复 Dandan 与 Animeko 源的别名传递丢失与内存污染隐患 (
dandan.js,animeko.js)aliases字段,导致下游handleAnimes构建比对池时缺少关键线索。此外,animeko.js中存在直接覆盖别名数组的隐患。[...m.titles])将多国译名浅拷贝注入到aliases中;修复了animeko的继承丢失问题。此举保证了本地别名能送达匹配校验层,并阻断了下游逻辑操作对全局缓存库的内存污染风险。重构 Bangumi Data 缓存与加载机制,降低常驻内存与磁盘占用 (
bangumi-data-util.js)JSON.parse()耗时。pruneBangumiData)。针对原始 JSON 结构执行精确剔除,仅保留项目中实际调用的 9 个目标站点(如bilibili、tmdb、anidb等),并丢弃不包含这些站点的无用条目及冗余字段(如broadcast、officialSite等)。相关 Issue
无
📋 提交前检查清单
无需