mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-05-04 09:47:31 +08:00
feat: merge year handle into api
This commit is contained in:
@@ -84,7 +84,9 @@ export async function searchFromApi(
|
||||
source: apiSite.key,
|
||||
source_name: apiName,
|
||||
class: item.vod_class,
|
||||
year: item.vod_year ? item.vod_year.match(/\d{4}/)?.[0] || '' : '',
|
||||
year: item.vod_year
|
||||
? item.vod_year.match(/\d{4}/)?.[0] || ''
|
||||
: 'unknown',
|
||||
desc: cleanHtmlTags(item.vod_content || ''),
|
||||
type_name: item.type_name,
|
||||
douban_id: item.vod_douban_id,
|
||||
@@ -154,7 +156,7 @@ export async function searchFromApi(
|
||||
class: item.vod_class,
|
||||
year: item.vod_year
|
||||
? item.vod_year.match(/\d{4}/)?.[0] || ''
|
||||
: '',
|
||||
: 'unknown',
|
||||
desc: cleanHtmlTags(item.vod_content || ''),
|
||||
type_name: item.type_name,
|
||||
douban_id: item.vod_douban_id,
|
||||
@@ -261,7 +263,7 @@ export async function getDetailFromApi(
|
||||
type: videoDetail.type_name,
|
||||
year: videoDetail.vod_year
|
||||
? videoDetail.vod_year.match(/\d{4}/)?.[0] || ''
|
||||
: '',
|
||||
: 'unknown',
|
||||
area: videoDetail.vod_area,
|
||||
director: videoDetail.vod_director,
|
||||
actor: videoDetail.vod_actor,
|
||||
@@ -330,7 +332,7 @@ async function handleSpecialSourceDetail(
|
||||
|
||||
// 提取年份
|
||||
const yearMatch = html.match(/>(\d{4})</);
|
||||
const yearText = yearMatch ? yearMatch[1] : '';
|
||||
const yearText = yearMatch ? yearMatch[1] : 'unknown';
|
||||
|
||||
return {
|
||||
code: 200,
|
||||
|
||||
@@ -16,7 +16,6 @@ interface FetchVideoDetailOptions {
|
||||
source: string;
|
||||
id: string;
|
||||
fallbackTitle?: string;
|
||||
fallbackYear?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,7 +27,6 @@ export async function fetchVideoDetail({
|
||||
source,
|
||||
id,
|
||||
fallbackTitle = '',
|
||||
fallbackYear = '',
|
||||
}: FetchVideoDetailOptions): Promise<VideoDetail> {
|
||||
// 优先通过搜索接口查找精确匹配
|
||||
if (fallbackTitle) {
|
||||
@@ -67,7 +65,7 @@ export async function fetchVideoDetail({
|
||||
source: data?.videoInfo?.source || source,
|
||||
source_name: data?.videoInfo?.source_name || '',
|
||||
class: data?.videoInfo?.remarks || '',
|
||||
year: data?.videoInfo?.year || fallbackYear || '',
|
||||
year: data?.videoInfo?.year || 'unknown',
|
||||
desc: data?.videoInfo?.desc || '',
|
||||
type_name: data?.videoInfo?.type || '',
|
||||
} as VideoDetail;
|
||||
|
||||
Reference in New Issue
Block a user