From 184f60e558df8988f13d54d8e28957eff331f9fb Mon Sep 17 00:00:00 2001 From: Elegy233 <82034747+wan0ge@users.noreply.github.com> Date: Mon, 25 May 2026 10:04:42 +0800 Subject: [PATCH] =?UTF-8?q?=20fix(kan360):=20=E4=BF=AE=E5=A4=8D360?= =?UTF-8?q?=E7=9C=8B=E6=BA=90=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96=E4=B8=AA?= =?UTF-8?q?=E5=88=AB=E5=89=A7=E7=9A=84=E6=9C=80=E6=96=B0=E4=B8=80=E9=9B=86?= =?UTF-8?q?=20(#317)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- danmu_api/sources/kan360.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/danmu_api/sources/kan360.js b/danmu_api/sources/kan360.js index 708d91b..c94c5c1 100644 --- a/danmu_api/sources/kan360.js +++ b/danmu_api/sources/kan360.js @@ -276,9 +276,27 @@ export default class Kan360Source extends BaseSource { if (globals.vodAllowedPlatforms.includes(anime.seriesSite)) { for (let i = 0; i < anime.seriesPlaylinks.length; i++) { const item = anime.seriesPlaylinks[i]; + let epUrl = ""; + + // 适配 seriesPlaylinks 列表中存在的异构数据节点 + // 1. 常规节点为包含 url 属性的对象结构 + if (item && typeof item === "object") { + epUrl = item.url || ""; + } + // 2. 特殊节点为字符串形态的关联链接 + // 忽略该关联链接,并从顶层 playlinks 提取当前站点的主链接进行数据映射 + else if (typeof item === "string") { + epUrl = (anime.playlinks && anime.playlinks[anime.seriesSite]) + ? anime.playlinks[anime.seriesSite] + : ""; + } + + // 过滤无有效 url 的空节点,避免生成非法格式的剧集对象 + if (!epUrl) continue; + links.push({ "name": (i + 1).toString(), - "url": item.url, + "url": epUrl, "title": `【${anime.seriesSite}】 第${i + 1}集` }); }