From e99bfa8b9767e7a68b489b5e456bf884d7d73436 Mon Sep 17 00:00:00 2001 From: renxia Date: Wed, 16 Aug 2023 15:17:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=92=AD=E6=94=BE=E5=9C=B0=E5=9D=80=E5=88=86=E9=9A=94=E7=AC=A6?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=97=B6=E4=BC=9A=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 20 ++++++++++---------- src/lib/video-search.ts | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index ced47e5..f63fbab 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "download", "ffmpeg" ], - "packageManager": "pnpm@7.6.0", + "packageManager": "pnpm@8.0.0", "engines": { "node": ">=14.18" }, @@ -44,15 +44,15 @@ "registry": "https://registry.npmjs.com" }, "devDependencies": { - "@lzwme/fed-lint-helper": "^2.3.4", - "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^6.1.0", - "@typescript-eslint/parser": "^6.1.0", - "eslint": "^8.45.0", - "eslint-config-prettier": "^8.8.0", + "@lzwme/fed-lint-helper": "^2.4.1", + "@types/node": "^20.5.0", + "@typescript-eslint/eslint-plugin": "^6.4.0", + "@typescript-eslint/parser": "^6.4.0", + "eslint": "^8.47.0", + "eslint-config-prettier": "^9.0.0", "eslint-plugin-prettier": "^5.0.0", "husky": "^8.0.3", - "prettier": "^3.0.0", + "prettier": "^3.0.2", "standard-version": "^9.5.0", "typescript": "^5.1.6" }, @@ -60,8 +60,8 @@ "@lzwme/fe-utils": "^1.5.2", "commander": "^11.0.0", "console-log-colors": "^0.4.0", - "enquirer": "^2.3.6", - "m3u8-parser": "^7.0.0" + "enquirer": "^2.4.1", + "m3u8-parser": "^7.1.0" }, "files": [ "cjs", diff --git a/src/lib/video-search.ts b/src/lib/video-search.ts index 673d7d3..ed19eea 100644 --- a/src/lib/video-search.ts +++ b/src/lib/video-search.ts @@ -239,8 +239,23 @@ export async function VideoSerachAndDL( return VideoSerachAndDL(keyword, options, baseOpts); } else { const info = vResult.list[0]; + if (!info.vod_play_url) { + logger.error('未获取到播放地址信息', info); + return VideoSerachAndDL(keyword, options, baseOpts); + } + + if (!info.vod_play_note || !String(info.vod_play_url).includes(info.vod_play_note)) { + ['#', '$'].some(d => { + if (info.vod_play_url.includes(d)) { + info.vod_play_note = d; + return true; + } + return true; + }); + } + const urls = info.vod_play_url - .split(info.vod_play_note) + .split(info.vod_play_note || '$') .find(d => d.includes('.m3u8')) .split('#');