mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
Merge branch 'dev'
This commit is contained in:
commit
08a2571acc
@ -2052,7 +2052,7 @@ export class tools extends plugin {
|
|||||||
|
|
||||||
const path = this.getCurDownloadPath(e);
|
const path = this.getCurDownloadPath(e);
|
||||||
await checkAndRemoveFile(path + "/temp.mp4")
|
await checkAndRemoveFile(path + "/temp.mp4")
|
||||||
await checkAndRemoveFile(path + "/temp.mp3")
|
await checkAndRemoveFile(path + "/temp.flac")
|
||||||
await checkAndRemoveFile(path + "/thumbnail.png")
|
await checkAndRemoveFile(path + "/thumbnail.png")
|
||||||
await ytDlpGetThumbnail(path, url, isOversea, this.myProxy, this.youtubeCookiePath)
|
await ytDlpGetThumbnail(path, url, isOversea, this.myProxy, this.youtubeCookiePath)
|
||||||
const title = ytDlpGetTilt(url, isOversea, this.myProxy, this.youtubeCookiePath).toString().replace(/\n/g, '');
|
const title = ytDlpGetTilt(url, isOversea, this.myProxy, this.youtubeCookiePath).toString().replace(/\n/g, '');
|
||||||
@ -2064,8 +2064,10 @@ export class tools extends plugin {
|
|||||||
`${this.identifyPrefix}识别:油管音乐\n视频标题:${title}`
|
`${this.identifyPrefix}识别:油管音乐\n视频标题:${title}`
|
||||||
]);
|
]);
|
||||||
await ytDlpHelper(path, url, isOversea, this.myProxy, this.videoDownloadConcurrency, true, graphics, timeRange, this.youtubeCookiePath);
|
await ytDlpHelper(path, url, isOversea, this.myProxy, this.videoDownloadConcurrency, true, graphics, timeRange, this.youtubeCookiePath);
|
||||||
e.reply(segment.record(`${path}/temp.mp3`));
|
if(this.isSendVocal){
|
||||||
this.uploadGroupFile(e, `${path}/temp.mp3`);
|
e.reply(segment.record(`${path}/temp.flac`));
|
||||||
|
}
|
||||||
|
this.uploadGroupFile(e, `${path}/temp.flac`);
|
||||||
// 发送完就截断
|
// 发送完就截断
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,15 @@ export function removeParams(url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function convertToSeconds(timeStr) {
|
export function convertToSeconds(timeStr) {
|
||||||
const [hour, minutes, seconds] = timeStr.split(':').map(Number); // 拆分并转换为数字
|
const parts = timeStr.split(':').map(Number);
|
||||||
if (!seconds) return timeStr;
|
if (parts.length === 2) {
|
||||||
return hour * 3600 + minutes * 60 + seconds; // 分钟转化为秒并加上秒数
|
const [minutes, seconds] = parts;
|
||||||
|
return minutes * 60 + seconds;
|
||||||
|
} else if (parts.length === 3) {
|
||||||
|
const [hours, minutes, seconds] = parts;
|
||||||
|
return hours * 3600 + minutes * 60 + seconds;
|
||||||
|
}
|
||||||
|
return timeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function autoSelectMusicOrVideoSend() {
|
export async function autoSelectMusicOrVideoSend() {
|
||||||
|
@ -96,7 +96,7 @@ export async function ytDlpHelper(path, url, isOversea, proxy, maxThreads, merge
|
|||||||
if (url.includes("music")) {
|
if (url.includes("music")) {
|
||||||
// 这里是 YouTube Music的处理逻辑
|
// 这里是 YouTube Music的处理逻辑
|
||||||
// e.g yt-dlp -x --audio-format mp3 https://youtu.be/5wEtefq9VzM -o test.mp3
|
// e.g yt-dlp -x --audio-format mp3 https://youtu.be/5wEtefq9VzM -o test.mp3
|
||||||
command = `yt-dlp -x --audio-format mp3 ${cookieParam} ${constructProxyParam(isOversea, proxy)} -P ${path} -o "temp.mp3" ${url}`;
|
command = `yt-dlp -x --audio-format flac -f ba ${cookieParam} ${constructProxyParam(isOversea, proxy)} -P ${path} -o "temp.flac" ${url}`;
|
||||||
} else {
|
} else {
|
||||||
// 正常情况下的处理逻辑
|
// 正常情况下的处理逻辑
|
||||||
const fParam = url.includes("youtu") ? `--download-sections "*${timeRange}" -f "bv${graphics}[ext=mp4]+ba[ext=m4a]" ` : "";
|
const fParam = url.includes("youtu") ? `--download-sections "*${timeRange}" -f "bv${graphics}[ext=mp4]+ba[ext=m4a]" ` : "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user