Repository navigation
feat(providers): migrate Bangumi online API to Next (api.bgm.tv → next.bgm.tv) - #23
Merged
Merged
Conversation
…xt.bgm.tv)
- search: POST /p1/search/subjects with limit (drop v0 search + legacy
fallback); get: /p1/subjects/{id}; relations: /p1/subjects/{id}/relations
with type=1&offprint=true server-side filter and limit=100 pagination
- adapt Next Subject/SlimSubject back to BangumiSubject: nameCN->name_cn,
airtime.date->date, rating.rank->rank, platform.typeCN->platform,
infobox values folded to v0 shape, 0-valued volumes/eps normalized to
None; total_episodes/age_rating dropped (absent in Next)
- replace the '漫画单行本' tag filter with shadow de-duplication: keep
series entries, drop single volumes only when their series entry is in
the same candidate set (keeps one-shots and spin-off series)
- match: redirect single-volume hits to their series entry via the new
seriesEntry field so series metadata lands on the series subject
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.
概要
将 Bangumi Provider 的在线元数据 API 从 v0(api.bgm.tv)迁移到 Next API(next.bgm.tv/p1),延续 tracker 侧已完成的迁移(d862fb7)。迁移方式:客户端边界适配——新增 Next 响应结构并适配回内部
BangumiSubject模型,mapper 的映射逻辑与既有测试零改动。端点变化
POST /v0/search/subjects(+旧 API 兜底)POST /p1/search/subjects?limit=≤100GET /v0/subjects/{id}GET /p1/subjects/{id}GET /v0/subjects/{id}/subjects(一次全量)GET /p1/subjects/{id}/relations?type=1&offprint=true(分页 limit=100)适配层要点
nameCN→name_cn、airtime.date→date、rating.rank→rank、platform.typeCN→platform[{key, values:[{k?,v}]}]折叠回 v0 形态(单值无 k→裸字符串,多值→数组),mapper 取值逻辑零改动volumes/eps为 0 归一为 None(对齐 v0 null 语义)total_episodes/age_ratingNext 无对应字段(书籍场景 v0 恒 0,无实际损失)_limit参数此前被忽略(每页最多 25 条),现启用(上限 100),搜索候选覆盖率提升单行本过滤:tag → 结构化影子去重
Next SlimSubject 无 tags,原「漫画单行本」tag 过滤不可用。实测验证后采用与 archive 离线路径同一套影子去重(
filter_shadowed_single_volumes泛化为shadow_dedup_single_volumes):series=false条目仅当同候选集内存在「同平台 + 名称前缀一致 + 余量为卷号装饰」的系列条目时才剔除match 增强:seriesEntry 重定向
Next 详情新增
seriesEntry(单行本→所属系列 id,实测 ONE PIECE (1)→3510,单发/系列均为 0)。系列匹配命中单行本时重定向取系列条目的元数据(该单行本仍经 relations 进入 books),失败回退原条目。测试
online_shadow_dedup_replaces_tag_filter(系列+单行本去重、单发保留、番外系列三案例)cargo test -p komf-core:286 passed / 0 failed;clippy 无新增警告;rustfmt 干净Ref: komf tracker 迁移 d862fb7;API 文档 https://next.bgm.tv/p1/