diff --git a/app/player/layout.tsx b/app/player/layout.tsx new file mode 100644 index 0000000..2eee97e --- /dev/null +++ b/app/player/layout.tsx @@ -0,0 +1,13 @@ +import { Metadata } from 'next'; + +export const metadata: Metadata = { + referrer: 'no-referrer', +}; + +export default function PlayerLayout({ + children, +}: { + children: React.ReactNode; +}) { + return children; +} diff --git a/lib/api/detail-api.ts b/lib/api/detail-api.ts index 0d75616..8656105 100644 --- a/lib/api/detail-api.ts +++ b/lib/api/detail-api.ts @@ -46,8 +46,21 @@ export async function getVideoDetail( const videoData = data.list[0]; - // Parse episodes from vod_play_url - const episodes = parseEpisodes(videoData.vod_play_url || ''); + // Handle multiple sources (separated by $$$) + const playFrom = (videoData.vod_play_from || '').split('$$$'); + const playUrls = (videoData.vod_play_url || '').split('$$$'); + + // Find the best source (prioritize m3u8) + let selectedIndex = 0; + + // Try to find a source that contains 'm3u8' in its name or code + const m3u8Index = playFrom.findIndex(code => code.toLowerCase().includes('m3u8')); + if (m3u8Index !== -1 && m3u8Index < playUrls.length) { + selectedIndex = m3u8Index; + } + + // Parse episodes from the selected source + const episodes = parseEpisodes(playUrls[selectedIndex] || ''); return { vod_id: videoData.vod_id, @@ -62,7 +75,7 @@ export async function getVideoDetail( type_name: videoData.type_name, episodes, source: source.id, - source_code: videoData.vod_play_from || '', + source_code: playFrom[selectedIndex] || '', }; } catch (error) { console.error(`Detail fetch failed for source ${source.name}:`, error);