🐞 fix: V1.3.1 修复油管解析bug

This commit is contained in:
zhiyu 2024-02-02 23:00:12 +08:00
parent df30b619ca
commit debecdc124
2 changed files with 7 additions and 3 deletions

View File

@ -175,6 +175,7 @@ YouTube解析参考了[yt-dlp:A youtube-dl fork with additional features and
| 左轮ps. 我导师,泪目!) | 1杯瑞幸 | | 左轮ps. 我导师,泪目!) | 1杯瑞幸 |
| mitsuha | 1杯瑞幸 | | mitsuha | 1杯瑞幸 |
| [Kr] 5s¹ | 1杯瑞幸 | | [Kr] 5s¹ | 1杯瑞幸 |
| 春日野穹OvO | 25 |
## 🚀 声明 ## 🚀 声明
* 文件借鉴了很多插件,精简个人认为可以精简的内容。 * 文件借鉴了很多插件,精简个人认为可以精简的内容。

View File

@ -988,15 +988,18 @@ export class tools extends plugin {
// 下载地址格式化 // 下载地址格式化
const path = `${ v }${ p ? `/p${ p }` : '' }`; const path = `${ v }${ p ? `/p${ p }` : '' }`;
const fullpath = `${ this.defaultPath }${ this.e.group_id || this.e.user_id }/${ path }`; const fullpath = `${ this.defaultPath }${ this.e.group_id || this.e.user_id }/${ path }`;
// 创建下载文件夹
await mkdirIfNotExists(fullpath);
// yt-dlp下载 // yt-dlp下载
let cmd = //`cd '${__dirname}' && (cd tmp > /dev/null || (mkdir tmp && cd tmp)) &&` + let cmd = //`cd '${__dirname}' && (cd tmp > /dev/null || (mkdir tmp && cd tmp)) &&` +
`yt-dlp ${ this.y2bCk !== undefined ? `--cookies ${ this.y2bCk }` : '' } https://youtu.be/${ v } -f ${ format.replace('x', '+') } ` + `yt-dlp ${ this.y2bCk !== undefined ? `--cookies ${ this.y2bCk }` : '' } ${url} -f ${ format.replace('x', '+') } ` +
`-o '${ fullpath }/${ v }.%(ext)s' ${ isProxy ? `--proxy ${ this.proxyAddr }:${ this.proxyPort }` : '' } -k --write-info-json`; `-o '${ fullpath }/${ v }.%(ext)s' ${ isProxy ? `--proxy ${ this.proxyAddr }:${ this.proxyPort }` : '' } -k --write-info-json`;
logger.info(cmd)
try { try {
await child_process.execSync(cmd); await child_process.execSync(cmd);
e.reply(segment.video(`${ fullpath }/${ v }.mp4`)) e.reply(segment.video(`${ fullpath }/${ v }.mp4`))
// 清理文件 // 清理文件
await deleteFolderRecursive(fullpath); // await deleteFolderRecursive(`${ fullpath.split('\/').slice(0, -2).join('/') }`);
} catch (error) { } catch (error) {
logger.error(error.toString()); logger.error(error.toString());
e.reply("y2b下载失败"); e.reply("y2b下载失败");