diff --git a/Dockerfile b/Dockerfile
index a76f666..a615af5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -51,7 +51,7 @@ ENV NODE_ENV=production
ENV HOSTNAME=0.0.0.0
ENV PORT=3000
ENV DOCKER_ENV=true
-ENV NEXT_PUBLIC_SITE_VERSION=fixed77
+ENV NEXT_PUBLIC_SITE_VERSION=fixed78
# 从构建器中复制 standalone 输出
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
diff --git a/src/app/api/douban-comments/route.ts b/src/app/api/douban-comments/route.ts
new file mode 100644
index 0000000..2f719ac
--- /dev/null
+++ b/src/app/api/douban-comments/route.ts
@@ -0,0 +1,54 @@
+import { NextRequest, NextResponse } from 'next/server';
+
+export const dynamic = 'force-dynamic';
+
+interface DoubanComment {
+ id: string;
+ user: string;
+ avatar: string;
+ rating: number;
+ content: string;
+ time: string;
+ location: string;
+}
+
+// 从豆瓣 rexxar 移动 API 获取短评(热门优先)
+export async function GET(req: NextRequest) {
+ const { searchParams } = new URL(req.url);
+ const id = (searchParams.get('id') || '').trim();
+ const sort = (searchParams.get('sort') || 'hot').trim(); // hot | new
+ const count = Math.min(parseInt(searchParams.get('count') || '10') || 10, 20);
+ if (!id) return NextResponse.json({ code: 0, msg: '缺少豆瓣ID', list: [] });
+
+ const order = sort === 'new' ? 'time' : 'hot';
+ const url = `https://m.douban.com/rexxar/api/v2/movie/${id}/interests?count=${count}&order_by=${order}&status=done`;
+
+ try {
+ const r = await fetch(url, {
+ headers: {
+ 'User-Agent':
+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1',
+ Referer: `https://m.douban.com/movie/subject/${id}/`,
+ Accept: 'application/json',
+ },
+ signal: AbortSignal.timeout(15000),
+ });
+ if (!r.ok) throw new Error(`HTTP ${r.status}`);
+ const d: any = await r.json();
+ const list: DoubanComment[] = (Array.isArray(d?.interests) ? d.interests : [])
+ .map((x: any) => ({
+ id: String(x?.id || ''),
+ user: String(x?.user?.name || ''),
+ avatar: String(x?.user?.avatar || ''),
+ rating: Number(x?.rating?.value || 0),
+ content: String(x?.comment || '').trim(),
+ time: String(x?.create_time || ''),
+ location: String(x?.ip_location || ''),
+ }))
+ .filter((c: DoubanComment) => c.content.length > 0);
+
+ return NextResponse.json({ code: 1, msg: 'ok', total: d?.total || list.length, list });
+ } catch (e: any) {
+ return NextResponse.json({ code: 0, msg: e?.message || 'fetch fail', list: [] });
+ }
+}
diff --git a/src/app/play/page.tsx b/src/app/play/page.tsx
index 94d489f..7e6ebad 100644
--- a/src/app/play/page.tsx
+++ b/src/app/play/page.tsx
@@ -1500,13 +1500,24 @@ function PlayPageClient() {
{/* 第一行:影片标题和操作按钮 */}
-
+
{videoTitle || '影片标题'}
{totalEpisodes > 1 && (
{` > 第 ${currentEpisodeIndex + 1} 集`}
)}
+ {detail?.douban_id && (
+
+ 豆瓣 →
+
+ )}
{/* 跳过设置按钮 */}
diff --git a/src/components/VideoMetaExtra.tsx b/src/components/VideoMetaExtra.tsx
index 80da8a7..44e88c5 100644
--- a/src/components/VideoMetaExtra.tsx
+++ b/src/components/VideoMetaExtra.tsx
@@ -3,11 +3,14 @@
import Link from 'next/link';
import { useEffect, useState } from 'react';
-interface HotComment {
- title: string;
+interface DoubanComment {
+ id: string;
+ user: string;
+ avatar: string;
+ rating: number;
content: string;
- url: string;
- source: string;
+ time: string;
+ location: string;
}
// 演员 / 评分 / 全网热评(详情页简介下方)
@@ -32,14 +35,14 @@ export default function VideoMetaExtra({
area?: string;
lang?: string;
}) {
- const [comments, setComments] = useState([]);
+ const [comments, setComments] = useState([]);
const [loading, setLoading] = useState(false);
useEffect(() => {
- if (!title) return;
+ if (!doubanId) return;
let alive = true;
setLoading(true);
- fetch(`/api/hot-comments?title=${encodeURIComponent(title)}`)
+ fetch(`/api/douban-comments?id=${encodeURIComponent(String(doubanId))}`)
.then((r) => r.json())
.then((d) => {
if (alive && d?.code === 1) setComments(d.list || []);
@@ -51,7 +54,7 @@ export default function VideoMetaExtra({
return () => {
alive = false;
};
- }, [title]);
+ }, [doubanId]);
const actors = (actor || '')
.split(/[,,、\/|]/)
@@ -124,10 +127,20 @@ export default function VideoMetaExtra({
)}
- {/* 全网热评 Top10 */}
+ {/* 豆瓣短评 */}
-
- 全网热评 Top10
(来自网上公开影评聚合)
+
{loading && comments.length === 0 && (
@@ -137,26 +150,29 @@ export default function VideoMetaExtra({
)}
{!loading && comments.length === 0 && (
-
暂无全网热评,换个片名或稍后再试。
+
暂无豆瓣短评。
)}
diff --git a/src/middleware.ts b/src/middleware.ts
index 4c4bf18..7bab587 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -170,6 +170,7 @@ function shouldSkipAuth(pathname: string): boolean {
'/api/tvbox',
'/api/filter',
'/api/license-config',
+ '/api/douban-comments',
];
return skipPaths.some((path) => pathname.startsWith(path));
@@ -178,6 +179,6 @@ function shouldSkipAuth(pathname: string): boolean {
// 配置middleware匹配规则
export const config = {
matcher: [
- '/((?!_next/static|_next/image|favicon.ico|login|warning|hls.min.js|mpegts.min.js|api/login|api/register|api/logout|api/cron|api/server-config|api/search|api/detail|api/image-proxy|api/license-config).*)',
+ '/((?!_next/static|_next/image|favicon.ico|login|warning|hls.min.js|mpegts.min.js|api/login|api/register|api/logout|api/cron|api/server-config|api/search|api/detail|api/image-proxy|api/license-config|api/douban-comments).*)',
],
};