From 712fc7489ebe5d3e3d2f2579a140f96ba5ebf8d6 Mon Sep 17 00:00:00 2001 From: mtvpls Date: Fri, 26 Dec 2025 00:54:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E6=BA=90=E5=88=B0=E7=A7=81=E4=BA=BA=E5=BD=B1=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/play/page.tsx | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/app/play/page.tsx b/src/app/play/page.tsx index 3e08715..588a510 100644 --- a/src/app/play/page.tsx +++ b/src/app/play/page.tsx @@ -904,6 +904,10 @@ function PlayPageClient() { !detailData.episodes || episodeIndex >= detailData.episodes.length ) { + // openlist 源的剧集是懒加载的,如果 episodes 为空则跳过 + if (detailData?.source === 'openlist' && (!detailData.episodes || detailData.episodes.length === 0)) { + return; + } setVideoUrl(''); return; } @@ -2073,7 +2077,7 @@ function PlayPageClient() { } } - const newDetail = availableSources.find( + let newDetail = availableSources.find( (source) => source.source === newSource && source.id === newId ); if (!newDetail) { @@ -2081,6 +2085,23 @@ function PlayPageClient() { return; } + // 如果是 openlist 源且 episodes 为空,需要调用 detail 接口获取完整信息 + if (newDetail.source === 'openlist' && (!newDetail.episodes || newDetail.episodes.length === 0)) { + try { + const detailResponse = await fetch(`/api/detail?source=${newSource}&id=${newId}`); + if (detailResponse.ok) { + newDetail = await detailResponse.json(); + } else { + throw new Error('获取 openlist 详情失败'); + } + } catch (err) { + console.error('获取 openlist 详情失败:', err); + setIsVideoLoading(false); + setError('获取视频详情失败,请重试'); + return; + } + } + // 尝试跳转到当前正在播放的集数 let targetIndex = currentEpisodeIndex; @@ -2922,6 +2943,11 @@ function PlayPageClient() { return; } + // openlist 源的剧集是懒加载的,如果 episodes 为空则跳过检查 + if ((currentSource === 'openlist' || detail?.source === 'openlist') && (!detail || !detail.episodes || detail.episodes.length === 0)) { + return; + } + // 确保选集索引有效 if ( !detail ||