Skip to content

Commit

Permalink
fix: 修复获取播放地址分隔符为空时会报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
renxia committed Aug 16, 2023
1 parent fd24780 commit e99bfa8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"download",
"ffmpeg"
],
"packageManager": "pnpm@7.6.0",
"packageManager": "pnpm@8.0.0",
"engines": {
"node": ">=14.18"
},
Expand All @@ -44,24 +44,24 @@
"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"
},
"dependencies": {
"@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",
Expand Down
17 changes: 16 additions & 1 deletion src/lib/video-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('#');

Expand Down

0 comments on commit e99bfa8

Please sign in to comment.