mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 08:09:19 +00:00
✨ feat: 新增Aria2c
进行下载
This commit is contained in:
parent
44f9844421
commit
76e9218852
@ -211,6 +211,8 @@ export class tools extends plugin {
|
|||||||
this.biliDuration = this.toolsConfig.biliDuration;
|
this.biliDuration = this.toolsConfig.biliDuration;
|
||||||
// 加载哔哩哔哩是否使用BBDown
|
// 加载哔哩哔哩是否使用BBDown
|
||||||
this.biliUseBBDown = this.toolsConfig.biliUseBBDown;
|
this.biliUseBBDown = this.toolsConfig.biliUseBBDown;
|
||||||
|
// 加载哔哩哔哩是否使用Aria2
|
||||||
|
this.biliUseAria2 = this.toolsConfig.biliUseAria2;
|
||||||
// 加载抖音Cookie
|
// 加载抖音Cookie
|
||||||
this.douyinCookie = this.toolsConfig.douyinCookie;
|
this.douyinCookie = this.toolsConfig.douyinCookie;
|
||||||
// 加载抖音是否压缩
|
// 加载抖音是否压缩
|
||||||
@ -627,7 +629,7 @@ export class tools extends plugin {
|
|||||||
// 删除之前的文件
|
// 删除之前的文件
|
||||||
await checkAndRemoveFile(`${tempPath}.mp4`);
|
await checkAndRemoveFile(`${tempPath}.mp4`);
|
||||||
// 下载视频
|
// 下载视频
|
||||||
await startBBDown(url, path, this.biliSessData);
|
await startBBDown(url, path, this.biliSessData, this.biliUseAria2);
|
||||||
// 发送视频
|
// 发送视频
|
||||||
return this.sendVideoToUpload(e, `${tempPath}.mp4`);
|
return this.sendVideoToUpload(e, `${tempPath}.mp4`);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ biliSessData: '' # 哔哩哔哩的SESSDATA
|
|||||||
biliIntroLenLimit: 50 # 哔哩哔哩简介长度限制,填 0 或者 -1 可以不做任何限制,显示完整简介
|
biliIntroLenLimit: 50 # 哔哩哔哩简介长度限制,填 0 或者 -1 可以不做任何限制,显示完整简介
|
||||||
biliDuration: 480 # 哔哩哔哩限制的最大视频时长(默认8分钟),单位:秒
|
biliDuration: 480 # 哔哩哔哩限制的最大视频时长(默认8分钟),单位:秒
|
||||||
biliUseBBDown: false # 是否使用BBDown,默认不开启,开启后使用强劲的BBDown下载最高画质
|
biliUseBBDown: false # 是否使用BBDown,默认不开启,开启后使用强劲的BBDown下载最高画质
|
||||||
|
biliUseAria2: false # 是否使用Aria2下载
|
||||||
|
|
||||||
douyinCookie: '' # douyin's cookie, 格式:odin_tt=xxx;passport_fe_beating_status=xxx;sid_guard=xxx;uid_tt=xxx;uid_tt_ss=xxx;sid_tt=xxx;sessionid=xxx;sessionid_ss=xxx;sid_ucp_v1=xxx;ssid_ucp_v1=xxx;passport_assist_user=xxx;ttwid=xxx;
|
douyinCookie: '' # douyin's cookie, 格式:odin_tt=xxx;passport_fe_beating_status=xxx;sid_guard=xxx;uid_tt=xxx;uid_tt_ss=xxx;sid_tt=xxx;sessionid=xxx;sessionid_ss=xxx;sid_ucp_v1=xxx;ssid_ucp_v1=xxx;passport_assist_user=xxx;ttwid=xxx;
|
||||||
douyinCompression: true # true-压缩,false-不压缩;是否使用压缩视频格式的抖音(默认使用),使用后加速视频发送
|
douyinCompression: true # true-压缩,false-不压缩;是否使用压缩视频格式的抖音(默认使用),使用后加速视频发送
|
||||||
|
@ -129,6 +129,14 @@ export function supportGuoba() {
|
|||||||
component: "Switch",
|
component: "Switch",
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: "tools.biliUseBBDown",
|
||||||
|
label: "使用Aria2下载",
|
||||||
|
bottomHelpMessage:
|
||||||
|
"【默认不开启,目前只有开启BBDown后才有效果】如果不爱折腾就使用默认下载方式,如果喜欢折腾就开启,开启后更加强劲,宽带直接拉满,Debian和Ubuntu用户直接使用命令安装:apt-get install aria2",
|
||||||
|
component: "Switch",
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: "tools.douyinCookie",
|
field: "tools.douyinCookie",
|
||||||
label: "抖音的Cookie",
|
label: "抖音的Cookie",
|
||||||
|
@ -3,9 +3,8 @@ import os from 'os';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测 BBDown 是否存在
|
* 检测 BBDown 是否存在
|
||||||
* @param callback
|
|
||||||
*/
|
*/
|
||||||
export function checkBBDown(callback) {
|
export function checkBBDown() {
|
||||||
// 根据操作系统选择命令
|
// 根据操作系统选择命令
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const command = os.platform() === 'win32' ? 'where BBDown' : 'which BBDown';
|
const command = os.platform() === 'win32' ? 'where BBDown' : 'which BBDown';
|
||||||
@ -27,8 +26,9 @@ export function checkBBDown(callback) {
|
|||||||
* @param videoUrl 视频链接
|
* @param videoUrl 视频链接
|
||||||
* @param downloadDir 下载目录
|
* @param downloadDir 下载目录
|
||||||
* @param biliSessData cookie
|
* @param biliSessData cookie
|
||||||
|
* @param biliUseAria2 使用Aria2
|
||||||
*/
|
*/
|
||||||
export function startBBDown(videoUrl, downloadDir, biliSessData) {
|
export function startBBDown(videoUrl, downloadDir, biliSessData, biliUseAria2) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// logger.info(videoUrl);
|
// logger.info(videoUrl);
|
||||||
// 解析URL并提取参数p(页数)
|
// 解析URL并提取参数p(页数)
|
||||||
@ -44,7 +44,7 @@ export function startBBDown(videoUrl, downloadDir, biliSessData) {
|
|||||||
urlObj.search = newParams.toString();
|
urlObj.search = newParams.toString();
|
||||||
videoUrl = urlObj.toString();
|
videoUrl = urlObj.toString();
|
||||||
// 说明:-F 自定义名称,-c 自定义Cookie, --work-dir 设置下载目录,-M 多p下载的时候命名
|
// 说明:-F 自定义名称,-c 自定义Cookie, --work-dir 设置下载目录,-M 多p下载的时候命名
|
||||||
const command = `BBDown ${videoUrl} --work-dir ${downloadDir} ${biliSessData ? '-c SESSDATA=' + biliSessData : ''} ${pageParam ? '-p ' + pageParam + ' -M \"temp\"' : '-p 1' + ' -M \"temp\"'} -F temp --skip-subtitle --skip-cover`;
|
const command = `BBDown ${videoUrl} --work-dir ${downloadDir} ${biliSessData ? '-c SESSDATA=' + biliSessData : ''} ${pageParam ? '-p ' + pageParam + ' -M \"temp\"' : '-p 1' + ' -M \"temp\"'} -F temp --skip-subtitle --skip-cover ${biliUseAria2 ? '--use-aria2c' : ''}`;
|
||||||
// logger.info(command);
|
// logger.info(command);
|
||||||
// 直接调用BBDown,因为它已经在系统路径中
|
// 直接调用BBDown,因为它已经在系统路径中
|
||||||
exec(command, (error, stdout, stderr) => {
|
exec(command, (error, stdout, stderr) => {
|
||||||
@ -56,7 +56,7 @@ export function startBBDown(videoUrl, downloadDir, biliSessData) {
|
|||||||
reject(`[R插件][BBDown]错误信息: ${stderr}`);
|
reject(`[R插件][BBDown]错误信息: ${stderr}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// logger.info(`[R插件][BBDown]输出结果: ${stdout}`);
|
// logger.mark(`[R插件][BBDown]输出结果: ${stdout}`);
|
||||||
resolve(stdout);
|
resolve(stdout);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user