From d6ea0a4748a24fd6600fec555d2ab4e5a7816794 Mon Sep 17 00:00:00 2001 From: katelya Date: Thu, 4 Sep 2025 13:11:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=99=BA=E8=83=BD=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E5=BD=B1=E8=A7=86=E6=BA=90=E7=B1=BB=E5=9E=8B=EF=BC=8C=E6=A0=B9?= =?UTF-8?q?=E6=8D=AEAPI=E5=9C=B0=E5=9D=80=E5=8A=A8=E6=80=81=E8=AE=BE?= =?UTF-8?q?=E7=BD=AEtype?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/api/tvbox/route.ts | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/app/api/tvbox/route.ts b/src/app/api/tvbox/route.ts index 4f595a7..c90b7a5 100644 --- a/src/app/api/tvbox/route.ts +++ b/src/app/api/tvbox/route.ts @@ -69,20 +69,25 @@ export async function GET(request: NextRequest) { wallpaper: `${baseUrl}/screenshot1.png`, // 使用项目截图作为壁纸 // 影视源配置 - sites: sourceConfigs.map((source) => ({ - key: source.key || source.name, - name: source.name, - type: 0, // 影视源 - api: source.api, - searchable: 1, // 可搜索 - quickSearch: 1, // 支持快速搜索 - filterable: 1, // 支持分类筛选 - ext: source.detail || '', // 详情页地址作为扩展参数 - timeout: 30, // 30秒超时 - categories: [ - "电影", "电视剧", "综艺", "动漫", "纪录片", "短剧" - ] - })), + sites: sourceConfigs.map((source) => { + // 智能判断type:如果api地址以.json结尾,则type为1,否则为0 + const type = source.api.toLowerCase().endsWith('.json') ? 1 : 0; + + return { + key: source.key || source.name, + name: source.name, + type: type, // 使用智能判断的type + api: source.api, + searchable: 1, // 可搜索 + quickSearch: 1, // 支持快速搜索 + filterable: 1, // 支持分类筛选 + ext: source.detail || '', // 详情页地址作为扩展参数 + timeout: 30, // 30秒超时 + categories: [ + "电影", "电视剧", "综艺", "动漫", "纪录片", "短剧" + ] + }; + }), // 解析源配置(添加一些常用的解析源) parses: [