🎈 fix: V1.6.6 修复上传文件函数

This commit is contained in:
zhiyu1998 2024-04-03 19:11:05 +08:00
parent cf14286c97
commit c4eaf682c2

View File

@ -328,7 +328,7 @@ export class tools extends plugin {
"os_version": "9", "os_version": "9",
"aweme_id": tiktokVideoId "aweme_id": tiktokVideoId
}) })
console.log(`${TIKTOK_INFO}?${params.toString()}`) // console.log(`${TIKTOK_INFO}?${params.toString()}`)
await fetch(`${TIKTOK_INFO}?${params.toString()}`, config) await fetch(`${TIKTOK_INFO}?${params.toString()}`, config)
.then(async resp => { .then(async resp => {
const respJson = await resp.json(); const respJson = await resp.json();
@ -506,18 +506,19 @@ export class tools extends plugin {
e.reply(`正在下载${ height }p ${ Math.trunc(frameRate) }帧数 视频,请稍候...`); e.reply(`正在下载${ height }p ${ Math.trunc(frameRate) }帧数 视频,请稍候...`);
const path = `${ this.getCurDownloadPath(e) }/`; const path = `${ this.getCurDownloadPath(e) }/`;
// 添加下载任务到并发队列 // 添加下载任务到并发队列
this.queue.add(() => this.downBili(`${ path }${ videoId }`, videoBaseUrl, audioBaseUrl) this.queue.add(() =>
.then(_ => { this.downBili(`${ path }${ videoId }`, videoBaseUrl, audioBaseUrl)
Bot.acquireGfs(e.group_id).upload(fs.readFileSync(`${ path }${ videoId }.mp4`)) .then(_ => {
}) e.group.sendFile(fs.readFileSync(`${ path }${ videoId }.mp4`));
.then(_ => { })
// 清除文件 .then(_ => {
fs.unlinkSync(`${ path }${ videoId }.mp4`); // 清除文件
}) fs.unlinkSync(`${ path }${ videoId }.mp4`);
.catch(err => { })
logger.error(`[R插件][B站下载引擎] ${err}`); .catch(err => {
e.reply("解析失败,请重试一下"); logger.error(`[R插件][B站下载引擎] ${err}`);
}) e.reply("解析失败,请重试一下");
})
); );
logger.mark(`[R插件][B站下载引擎] 当前下载队列大小${ this.queue.size }`); logger.mark(`[R插件][B站下载引擎] 当前下载队列大小${ this.queue.size }`);
@ -1028,7 +1029,7 @@ export class tools extends plugin {
// e.reply(segment.video(path + "/temp.mp4")); // e.reply(segment.video(path + "/temp.mp4"));
// }); // });
downloadMp3(url, 'follow').then(path => { downloadMp3(url, 'follow').then(path => {
Bot.acquireGfs(e.group_id).upload(fs.readFileSync(path), '/', `${title.replace(/[\/\?<>\\:\*\|".… ]/g, '')}.mp3`) e.group.sendFile(fs.readFileSync(path), '/', `${ title.replace(/[\/\?<>\\:\*\|".… ]/g, '') }.mp3`);
}) })
.catch(err => { .catch(err => {
console.error(`下载音乐失败,错误信息为: ${err.message}`); console.error(`下载音乐失败,错误信息为: ${err.message}`);