fix: 详情页相关推荐点击直达播放页 播放页标题匹配加放宽兜底 (fixed129)
Docker Build & Test / build (push) Canceled after 0s
Docker Build & Test / test (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/amd64) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm/v7) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm64) (push) Canceled after 0s
Build & Push Docker image / merge-images (push) Canceled after 0s
Release / release (push) Canceled after 0s
Release / docker (push) Canceled after 0s

This commit is contained in:
jinghui committed 2026-11-15 01:24:48 +08:00
1 parent 3362970fff
commit 4c4d065951
5 files changed
+60 -15

No files matched your search

+34 -12
View File
@@ -520,19 +520,41 @@ function PlayPageClient() {
allResults = data.results;
}
// 处理搜索结果,根据规则过滤
const results = allResults.filter(
(result: SearchResult) =>
result.title.replaceAll(' ', '').toLowerCase() ===
videoTitleRef.current.replaceAll(' ', '').toLowerCase() &&
(videoYearRef.current
? result.year.toLowerCase() === videoYearRef.current.toLowerCase()
: true) &&
(searchType
? (searchType === 'tv' && result.episodes.length > 1) ||
// 处理搜索结果,根据规则过滤(精确匹配优先)
const strict = (result: SearchResult) =>
result.title.replaceAll(' ', '').toLowerCase() ===
videoTitleRef.current.replaceAll(' ', '').toLowerCase() &&
(videoYearRef.current
? result.year.toLowerCase() === videoYearRef.current.toLowerCase()
: true) &&
(searchType
? (searchType === 'tv' && result.episodes.length > 1) ||
(searchType === 'movie' && result.episodes.length === 1)
: true);
let results = allResults.filter(strict);
// 精确匹配不到(相关推荐/豆瓣标题与源站标题常有差异)→ 放宽到双向包含;
// 仍要求满足 searchType 语义;再找不到才走「未找到匹配结果」
if (!results.length && videoTitleRef.current) {
const norm = (x: string) =>
x.replaceAll(' ', '')
.replaceAll('·', '')
.replaceAll(':', '')
.replaceAll(':', '')
.toLowerCase();
const q = norm(videoTitleRef.current);
results = allResults.filter((result: SearchResult) => {
const tt = norm(result.title);
if (!tt || !q) return false;
if (!(tt.includes(q) || q.includes(tt))) return false;
if (searchType) {
return (
(searchType === 'tv' && result.episodes.length > 1) ||
(searchType === 'movie' && result.episodes.length === 1)
: true)
);
);
}
return true;
});
}
setAvailableSources(results);
return results;
} catch (err) {
+1 -1
View File
@@ -215,7 +215,7 @@ export default function VideoMetaExtra({
{related.map((r: any) => (
<a
key={r.id}
href={`/search?q=${encodeURIComponent(r.title)}`}
href={`/play?title=${encodeURIComponent(r.title)}`}
target='_self'
rel='noreferrer'
className='group block'