将动画封面获取源从 Anitabi CDN 切换至 Bangumi 官方 API 并支持异步加载#18
Open
peterwang1996 wants to merge 2 commits into
Open
Conversation
peterwang1996
marked this pull request as draft
July 16, 2026 02:49
peterwang1996
marked this pull request as ready for review
July 16, 2026 02:50
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.
💡 功能改动 (What Changed)
api.anitabi.cn拼接静态 URL 获取封面的方式,改为调用 Bangumi 官方接口 ([https://api.bgm.tv/v0/subjects/](https://api.bgm.tv/v0/subjects/){id}) 获取详细数据,并使用官方返回的large(高清大图)作为封面图源。async/await),确保在接口成功返回封面 URL 后再进行 DOM 更新与 Canvas 绘制。🛠 实现思路 (Implementation Details)
async function。get请求 API 动态获取条目详情,并提取data.images.large字段,若无数据则进行 fallback 处理(返回null)。async方法。Promise.all + Array.map的结合方式,并发请求列表中所有动画的封面 URL。待所有 Promise 解析完成后,再统一拼接 HTML 插入至innerHTML,避免因串行请求导致渲染阻塞或出现白屏闪烁。async方法。loadImage方法前,先await getCoverURLById(id)获取到真实的封面图片地址,再执行后续计算宽高比与绘制的逻辑。@itorr