mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-02-28 15:54:43 +08:00
feat: fetch douban video info with year
This commit is contained in:
@@ -8,6 +8,7 @@ interface DoubanCategoryApiResponse {
|
||||
items: Array<{
|
||||
id: string;
|
||||
title: string;
|
||||
card_subtitle: string;
|
||||
pic: {
|
||||
large: string;
|
||||
normal: string;
|
||||
@@ -106,6 +107,7 @@ export async function GET(request: Request) {
|
||||
title: item.title,
|
||||
poster: item.pic?.normal || item.pic?.large || '',
|
||||
rate: item.rating?.value ? item.rating.value.toFixed(1) : '',
|
||||
year: item.card_subtitle?.match(/(\d{4})/)?.[1] || '',
|
||||
}));
|
||||
|
||||
const response: DoubanResult = {
|
||||
|
||||
@@ -100,6 +100,7 @@ export async function GET(request: Request) {
|
||||
title: item.title,
|
||||
poster: item.cover,
|
||||
rate: item.rate,
|
||||
year: '',
|
||||
}));
|
||||
|
||||
const response: DoubanResult = {
|
||||
@@ -171,6 +172,7 @@ function handleTop250(pageStart: number) {
|
||||
title: title,
|
||||
poster: processedCover,
|
||||
rate: rate,
|
||||
year: '',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -294,6 +294,7 @@ function DoubanPageClient() {
|
||||
poster={item.poster}
|
||||
douban_id={item.id}
|
||||
rate={item.rate}
|
||||
year={item.year}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
getAllPlayRecords,
|
||||
subscribeToDataUpdates,
|
||||
} from '@/lib/db.client';
|
||||
import { getDoubanRecommends } from '@/lib/douban.client';
|
||||
import { getDoubanCategories } from '@/lib/douban.client';
|
||||
import { DoubanItem } from '@/lib/types';
|
||||
|
||||
import CapsuleSwitch from '@/components/CapsuleSwitch';
|
||||
@@ -65,8 +65,12 @@ function HomeClient() {
|
||||
|
||||
// 并行获取热门电影和热门剧集
|
||||
const [moviesData, tvShowsData] = await Promise.all([
|
||||
getDoubanRecommends({ type: 'movie', tag: '热门' }),
|
||||
getDoubanRecommends({ type: 'tv', tag: '热门' }),
|
||||
getDoubanCategories({
|
||||
kind: 'movie',
|
||||
category: '热门',
|
||||
type: '全部',
|
||||
}),
|
||||
getDoubanCategories({ kind: 'tv', category: 'tv', type: 'tv' }),
|
||||
]);
|
||||
|
||||
if (moviesData.code === 200) {
|
||||
@@ -242,6 +246,7 @@ function HomeClient() {
|
||||
poster={movie.poster}
|
||||
douban_id={movie.id}
|
||||
rate={movie.rate}
|
||||
year={movie.year}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
@@ -288,6 +293,7 @@ function HomeClient() {
|
||||
poster={show.poster}
|
||||
douban_id={show.id}
|
||||
rate={show.rate}
|
||||
year={show.year}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user