🐞 fix: 修复Windows下解析ytb出现错误[#I9QCR8]

1. 修复Windows下解析ytb出现错误
2. 修复 xhs 文档问题
3. 上传视频增加兜底策略
This commit is contained in:
zhiyu1998 2024-08-08 23:02:11 +08:00
parent b25835c7e5
commit 156e2b5bfc

View File

@ -989,7 +989,7 @@ export class tools extends plugin {
const downloadPath = `${this.getCurDownloadPath(e)}`; const downloadPath = `${this.getCurDownloadPath(e)}`;
// 检测没有 cookie 则退出 // 检测没有 cookie 则退出
if (_.isEmpty(this.xiaohongshuCookie)) { if (_.isEmpty(this.xiaohongshuCookie)) {
e.reply(`2024-8-2后反馈必须使用ck不然无法解析请填写相关ck\n文档:${HELP_DOC}`); e.reply(`2024-8-2后反馈必须使用ck不然无法解析请填写相关ck\n${HELP_DOC}`);
return; return;
} }
// 获取信息 // 获取信息
@ -1325,7 +1325,7 @@ export class tools extends plugin {
*/ */
async dy2b(path, url, isOversea) { async dy2b(path, url, isOversea) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const command = `yt-dlp ${isOversea ? "" : `--proxy ${this.myProxy}`} -P ${path} -o "temp.%(ext)s" -f 'best[height<=720][ext=mp4]' --merge-output-format "mp4" ${url}`; const command = `yt-dlp ${isOversea ? "" : `--proxy ${this.myProxy}`} -P ${path} -o "temp.%(ext)s" --merge-output-format "mp4" ${url}`;
exec(command, (error, stdout) => { exec(command, (error, stdout) => {
if (error) { if (error) {
console.error(`Error executing command: ${error}`); console.error(`Error executing command: ${error}`);
@ -2084,6 +2084,7 @@ export class tools extends plugin {
* @param videoSizeLimit 发送转上传视频的大小限制默认70MB * @param videoSizeLimit 发送转上传视频的大小限制默认70MB
*/ */
async sendVideoToUpload(e, path, videoSizeLimit = this.videoSizeLimit) { async sendVideoToUpload(e, path, videoSizeLimit = this.videoSizeLimit) {
try {
// logger.info(videoSizeLimit); // logger.info(videoSizeLimit);
const isLag = await this.isLagRangeDriver(); const isLag = await this.isLagRangeDriver();
// 判断是否是拉格朗日 // 判断是否是拉格朗日
@ -2107,6 +2108,11 @@ export class tools extends plugin {
} else { } else {
e.reply(segment.video(path)); e.reply(segment.video(path));
} }
} catch (err) {
logger.error(`[R插件][发送视频判断是否需要上传] 发生错误:\n ${err}`);
e.reply(`上传发生错误R插件正在为你采用备用策略请稍等如果发不出来请再次尝试`);
e.reply(segment.video(path));
}
} }
/** /**