From 729a84d3f3e44e7603a732f1fd333b5542450689 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A7=8B=E5=88=80=E9=B1=BC?=
<9903082+qdyovo@user.noreply.gitee.com>
Date: Thu, 7 Nov 2024 13:55:11 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=A6=84=20reactor:=20=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E7=82=B9=E6=AD=8C=E4=BF=A1=E6=81=AF=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/songRequest.js | 59 +++++++--
model/neteaseMusicInfo.js | 17 +++
.../neteaseMusicInfo/neteaseMusicInfo.css | 125 ++++++++++++++++++
.../neteaseMusicInfo/neteaseMusicInfo.html | 45 +++++++
4 files changed, 234 insertions(+), 12 deletions(-)
create mode 100644 model/neteaseMusicInfo.js
create mode 100644 resources/html/neteaseMusicInfo/neteaseMusicInfo.css
create mode 100644 resources/html/neteaseMusicInfo/neteaseMusicInfo.html
diff --git a/apps/songRequest.js b/apps/songRequest.js
index eba702e..53196a4 100644
--- a/apps/songRequest.js
+++ b/apps/songRequest.js
@@ -2,6 +2,7 @@ import axios from "axios";
import { formatTime } from '../utils/other.js'
import puppeteer from "../../../lib/puppeteer/puppeteer.js";
import PickSongList from "../model/pick-song.js";
+import NeteaseMusicInfo from '../model/neteaseMusicInfo.js'
import { NETEASE_API_CN, NETEASE_SONG_DOWNLOAD, NETEASE_TEMP_API } from "../constants/tools.js";
import { COMMON_USER_AGENT, REDIS_YUNZAI_ISOVERSEA, REDIS_YUNZAI_SONGINFO } from "../constants/constant.js";
import { downloadAudio } from "../utils/common.js";
@@ -105,7 +106,7 @@ export class songRequest extends plugin {
await redisSetKey(REDIS_YUNZAI_SONGINFO, songInfo)
const data = await new PickSongList(e).getData(musicDate.data)
let img = await puppeteer.screenshot("pick-song", data);
- e.reply(img, true);
+ e.reply(img);
} else {
e.reply('暂未找到你想听的歌哦~')
}
@@ -119,10 +120,11 @@ export class songRequest extends plugin {
const saveId = songInfo.findIndex(item => item.group_id === e.group.group_id)
const AUTO_NETEASE_SONG_DOWNLOAD = autoSelectNeteaseApi + "/song/url/v1?id={}&level=" + this.neteaseCloudAudioQuality;
const pickSongUrl = AUTO_NETEASE_SONG_DOWNLOAD.replace("{}", songInfo[saveId].data[pickNumber].id)
+ const songWikiUrl = autoSelectNeteaseApi + '/song/wiki/summary?id=' + songInfo[saveId].data[pickNumber].id
const statusUrl = autoSelectNeteaseApi + '/login/status' //用户状态API
const isCkExpired = await this.checkCooike(statusUrl)
// // 请求netease数据
- this.neteasePlay(e, pickSongUrl, songInfo[saveId].data, pickNumber, isCkExpired)
+ this.neteasePlay(e, pickSongUrl, songWikiUrl, songInfo[saveId].data, pickNumber, isCkExpired)
}
}
@@ -173,8 +175,9 @@ export class songRequest extends plugin {
})
const pickSongUrl = AUTO_NETEASE_SONG_DOWNLOAD.replace("{}", songInfo[0].id)
const statusUrl = autoSelectNeteaseApi + '/login/status' //用户状态API
+ const songWikiUrl = autoSelectNeteaseApi + '/song/wiki/summary?id=' + songInfo[0].id
const isCkExpired = await this.checkCooike(statusUrl)
- this.neteasePlay(e, pickSongUrl, songInfo, 0, isCkExpired)
+ this.neteasePlay(e, pickSongUrl, songWikiUrl, songInfo, 0, isCkExpired)
} else {
e.reply('暂未找到你想听的歌哦~')
}
@@ -256,11 +259,11 @@ export class songRequest extends plugin {
}
// 网易云音乐下载策略
- neteasePlay(e, pickSongUrl, songInfo, pickNumber = 0, isCkExpired) {
+ neteasePlay(e, pickSongUrl, songWikiUrl, songInfo, pickNumber = 0, isCkExpired) {
axios.get(pickSongUrl, {
headers: {
"User-Agent": COMMON_USER_AGENT,
- "Cookie": this.neteaseCookie
+ // "Cookie": this.neteaseCookie
},
}).then(async resp => {
// 国内解决方案,替换API后这里也需要修改
@@ -291,18 +294,49 @@ export class songRequest extends plugin {
let url = await resp.data.data?.[0]?.url || null;
const AudioLevel = translateToChinese(resp.data.data?.[0]?.level)
const AudioSize = bytesToMB(resp.data.data?.[0]?.size)
- // 获取歌曲信息
+
+ // 获取歌曲标题
let title = songInfo[pickNumber].songName + '-' + songInfo[pickNumber].singerName
+ let typelist = []
+ // 歌曲百科API
+ await axios.get(songWikiUrl, {
+ headers: {
+ "User-Agent": COMMON_USER_AGENT,
+ // "Cookie": this.neteaseCookie
+ },
+ }).then(res => {
+ const wikiData = res.data.data.blocks[1].creatives
+
+ typelist.push(wikiData[0].resources[0].uiElement.mainTitle.title)
+ // 防止数据过深出错
+ const recTags = wikiData[1]
+ for (let i = 0; i < Math.min(3, recTags.resources.length); i++) {
+ if (recTags.resources[i] && recTags.resources[i].uiElement && recTags.resources[i].uiElement.mainTitle.title) {
+ typelist.push(recTags.resources[i].uiElement.mainTitle.title)
+ }
+ }
+ typelist.push(wikiData[2].uiElement.textLinks[0].text)
+ typelist.push(AudioLevel)
+ })
+ let musicInfo = {
+ 'cover': songInfo[pickNumber].cover,
+ 'songName': songInfo[pickNumber].songName,
+ 'singerName': songInfo[pickNumber].singerName,
+ 'size': AudioSize,
+ 'musicType': typelist
+ }
// 一般这个情况是VIP歌曲 (如果没有url或者是国内,公用接口暂时不可用,必须自建并且ck可用状态才能进行高质量解析)
- if (!isCkExpired || url == null) {
- url = await this.musicTempApi(e, title, "网易云音乐");
+ if (!isCkExpired || this.useLocalNeteaseAPI || url == null) {
+ url = await this.musicTempApi(e, musicInfo, title);
} else {
// 拥有ck,并且有效,直接进行解析
let audioInfo = AudioLevel;
if (AudioLevel == '杜比全景声') {
audioInfo += '\n(杜比下载文件为MP4,编码格式为AC-4,需要设备支持才可播放)';
}
- e.reply([segment.image(songInfo[pickNumber].cover), `${this.identifyPrefix}识别:网易云音乐,${title}\n当前下载音质: ${audioInfo}\n预估大小: ${AudioSize}MB`]);
+ const data = await new NeteaseMusicInfo(e).getData(musicInfo)
+ let img = await puppeteer.screenshot("neteaseMusicInfo", data);
+ e.reply(img);
}
// 动态判断后缀名
let musicExt = resp.data.data?.[0]?.type
@@ -333,7 +367,7 @@ export class songRequest extends plugin {
});
}
- async musicTempApi(e, title, musicType) {
+ async musicTempApi(e, musicInfo, title) {
let musicReqApi = NETEASE_TEMP_API;
// 临时接口,title经过变换后搜索到的音乐质量提升
const vipMusicData = await axios.get(musicReqApi.replace("{}", title.replace("-", " ")), {
@@ -344,8 +378,9 @@ export class songRequest extends plugin {
const messageTitle = title + "\nR插件检测到当前为VIP音乐,正在转换...";
// ??后的内容是适配`QQ_MUSIC_TEMP_API`、最后是汽水
const url = vipMusicData.data?.music_url ?? vipMusicData.data?.data?.music_url ?? vipMusicData.data?.music;
- const cover = vipMusicData.data?.cover ?? vipMusicData.data?.data?.cover ?? vipMusicData.data?.cover;
- await e.reply([segment.image(cover), `${this.identifyPrefix}识别:${musicType},${messageTitle}`]);
+ const data = await new NeteaseMusicInfo(e).getData(musicInfo)
+ let img = await puppeteer.screenshot("neteaseMusicInfo", data);
+ e.reply(img);
return url;
}
diff --git a/model/neteaseMusicInfo.js b/model/neteaseMusicInfo.js
new file mode 100644
index 0000000..b62914e
--- /dev/null
+++ b/model/neteaseMusicInfo.js
@@ -0,0 +1,17 @@
+import Base from './base.js'
+
+export default class NeteaseMusicInfo extends Base {
+ constructor (e) {
+ super(e)
+ this.model = 'neteaseMusicInfo'
+ }
+
+ /** 生成版本信息图片 */
+ async getData (songInfo) {
+ return {
+ ...this.screenData,
+ saveId: 'neteaseMusicInfo',
+ songInfo: songInfo,
+ }
+ }
+}
diff --git a/resources/html/neteaseMusicInfo/neteaseMusicInfo.css b/resources/html/neteaseMusicInfo/neteaseMusicInfo.css
new file mode 100644
index 0000000..def1ce0
--- /dev/null
+++ b/resources/html/neteaseMusicInfo/neteaseMusicInfo.css
@@ -0,0 +1,125 @@
+@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;700&display=swap');
+
+@font-face {
+ font-family: 'singerName';
+ src: url("../../font/江城月湖体\ 400W.ttf");
+}
+
+body,
+html {
+ margin: 0;
+ padding: 0;
+ width: 780px;
+ height: 370px;
+ font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
+}
+
+.bg-image,
+.img {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 780px;
+ height:450px;
+ z-index: -1;
+ object-fit: cover;
+}
+
+.inner {
+ background: rgba(0, 0, 0, 0.6);
+ backdrop-filter: blur(5px);
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+
+.infoBox {
+ width: 100%;
+ height: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ box-sizing: border-box;
+}
+
+.info {
+ width: 100%;
+ height: 100%;
+ border: 0px solid #ffffff2e;
+ backdrop-filter: blur(10px);
+ background: hsla(0, 0%, 100%, 0.281);
+ box-shadow: 0 6px 15px 0 #8e8e8e30;
+}
+
+.cover {
+ margin-top: 28px;
+ width: 100%;
+ height: 135px;
+ display: flex;
+ justify-content: center;
+}
+
+.cover img {
+ width: 135px;
+ height: 135px;
+ border-radius: 10px;
+ box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
+}
+
+.songSize{
+ width: 100%;
+ text-align: center;
+ margin-top: 20px;
+ font-size: 18px;
+ font-family: 'singerName';
+ color: #fff;
+ text-shadow: 2px 2px 5px rgba(255, 255, 255, 0.4);
+}
+
+.songName {
+ width: 100%;
+ text-align: center;
+ margin-top: 10px;
+ font-size: 20px;
+ color: #fff;
+ text-shadow: 2px 2px 5px rgba(255, 255, 255, 0.4);
+}
+
+.singerName{
+ width: 100%;
+ text-align: center;
+ font-family: 'singerName';
+ margin-top: 17px;
+ font-size: 17px;
+ color: #fff;
+ text-shadow: 2px 2px 5px rgba(255, 255, 255, 0.4);
+}
+
+.typeBox{
+ width: 100%;
+ margin-top: 22px;
+ display: flex;
+ justify-content: center;
+}
+
+.typeList{
+ display: flex;
+}
+
+.typeNav{
+ font-size: 15px;
+ height: 25px;
+ padding: 0px 10px;
+ box-sizing: border-box;
+ background-color:rgba(255, 255, 255, 0.2);
+ line-height: 0px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 12.5px;
+ margin-left: 10px;
+ color: #fff;
+ box-shadow: 0px 0px 3px rgba(255, 255, 255, 0.4);
+}
\ No newline at end of file
diff --git a/resources/html/neteaseMusicInfo/neteaseMusicInfo.html b/resources/html/neteaseMusicInfo/neteaseMusicInfo.html
new file mode 100644
index 0000000..9fe0724
--- /dev/null
+++ b/resources/html/neteaseMusicInfo/neteaseMusicInfo.html
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+ 歌曲信息
+
+
+
+
+
+

+
+
+
+
+
+

+
+
+ {{ songInfo.size }} MB
+
+
+ {{ songInfo.songName }}
+
+
+ {{ songInfo.singerName }}
+
+
+
+ {{each songInfo.musicType typeName}}
+
+ {{ typeName }}
+
+ {{ /each }}
+
+
+
+
+
+
+
\ No newline at end of file
From bdfe607b95b94fa64222e081ed371e32db63be88 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A7=8B=E5=88=80=E9=B1=BC?=
<9903082+qdyovo@user.noreply.gitee.com>
Date: Thu, 7 Nov 2024 14:15:34 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8D?=
=?UTF-8?q?=E9=A5=BC=E5=B9=B2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/songRequest.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/apps/songRequest.js b/apps/songRequest.js
index 53196a4..3f2f56e 100644
--- a/apps/songRequest.js
+++ b/apps/songRequest.js
@@ -263,7 +263,7 @@ export class songRequest extends plugin {
axios.get(pickSongUrl, {
headers: {
"User-Agent": COMMON_USER_AGENT,
- // "Cookie": this.neteaseCookie
+ "Cookie": this.neteaseCookie
},
}).then(async resp => {
// 国内解决方案,替换API后这里也需要修改
@@ -326,7 +326,7 @@ export class songRequest extends plugin {
'musicType': typelist
}
// 一般这个情况是VIP歌曲 (如果没有url或者是国内,公用接口暂时不可用,必须自建并且ck可用状态才能进行高质量解析)
- if (!isCkExpired || this.useLocalNeteaseAPI || url == null) {
+ if (!isCkExpired || url == null) {
url = await this.musicTempApi(e, musicInfo, title);
} else {
// 拥有ck,并且有效,直接进行解析
From 8a645cf3266f6ea4506a1b6e3b09131a3d1c8496 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A7=8B=E5=88=80=E9=B1=BC?=
<9903082+qdyovo@user.noreply.gitee.com>
Date: Thu, 7 Nov 2024 17:09:23 +0800
Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=A6=84=20reactor:=20=E9=80=82?=
=?UTF-8?q?=E9=85=8D=E9=9F=B3=E4=B9=90=E8=A7=A3=E6=9E=90=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/songRequest.js | 25 ++++++++----
apps/tools.js | 94 ++++++++++++++++++++++++++++++++++++++-------
2 files changed, 97 insertions(+), 22 deletions(-)
diff --git a/apps/songRequest.js b/apps/songRequest.js
index 3f2f56e..abc5a97 100644
--- a/apps/songRequest.js
+++ b/apps/songRequest.js
@@ -310,19 +310,27 @@ export class songRequest extends plugin {
typelist.push(wikiData[0].resources[0].uiElement.mainTitle.title)
// 防止数据过深出错
const recTags = wikiData[1]
- for (let i = 0; i < Math.min(3, recTags.resources.length); i++) {
- if (recTags.resources[i] && recTags.resources[i].uiElement && recTags.resources[i].uiElement.mainTitle.title) {
- typelist.push(recTags.resources[i].uiElement.mainTitle.title)
+ if (recTags.resources[0]) {
+ for (let i = 0; i < Math.min(3, recTags.resources.length); i++) {
+ if (recTags.resources[i] && recTags.resources[i].uiElement && recTags.resources[i].uiElement.mainTitle.title) {
+ typelist.push(recTags.resources[i].uiElement.mainTitle.title)
+ }
}
+ } else {
+ if (recTags.uiElement.textLinks[0].text) typelist.push(recTags.uiElement.textLinks[0].text)
+ }
+ if (wikiData[2].uiElement.mainTitle.title == 'BPM') {
+ typelist.push('BPM ' + wikiData[2].uiElement.textLinks[0].text)
+ } else {
+ typelist.push(wikiData[2].uiElement.textLinks[0].text)
}
- typelist.push(wikiData[2].uiElement.textLinks[0].text)
typelist.push(AudioLevel)
})
let musicInfo = {
'cover': songInfo[pickNumber].cover,
'songName': songInfo[pickNumber].songName,
'singerName': songInfo[pickNumber].singerName,
- 'size': AudioSize,
+ 'size': AudioSize + ' MB',
'musicType': typelist
}
// 一般这个情况是VIP歌曲 (如果没有url或者是国内,公用接口暂时不可用,必须自建并且ck可用状态才能进行高质量解析)
@@ -375,9 +383,10 @@ export class songRequest extends plugin {
"User-Agent": COMMON_USER_AGENT,
},
});
- const messageTitle = title + "\nR插件检测到当前为VIP音乐,正在转换...";
- // ??后的内容是适配`QQ_MUSIC_TEMP_API`、最后是汽水
- const url = vipMusicData.data?.music_url ?? vipMusicData.data?.data?.music_url ?? vipMusicData.data?.music;
+ const url = vipMusicData.data?.music_url
+ const id = vipMusicData.data?.id ?? vipMusicData.data?.data?.quality ?? vipMusicData.data?.pay;
+ musicInfo.size = id
+ musicInfo.musicType = musicInfo.musicType.slice(0, -1)
const data = await new NeteaseMusicInfo(e).getData(musicInfo)
let img = await puppeteer.screenshot("neteaseMusicInfo", data);
e.reply(img);
diff --git a/apps/tools.js b/apps/tools.js
index d84f849..833c918 100644
--- a/apps/tools.js
+++ b/apps/tools.js
@@ -57,6 +57,7 @@ import {
XHS_REQ_LINK
} from "../constants/tools.js";
import BiliInfoModel from "../model/bili-info.js";
+import NeteaseMusicInfo from '../model/neteaseMusicInfo.js'
import config from "../model/config.js";
import NeteaseModel from "../model/netease.js";
import * as aBogus from "../utils/a-bogus.cjs";
@@ -104,7 +105,7 @@ import Translate from "../utils/trans-strategy.js";
import { mid2id } from "../utils/weibo.js";
import { convertToSeconds, removeParams, ytbFormatTime } from "../utils/youtube.js";
import { ytDlpGetDuration, ytDlpGetThumbnail, ytDlpGetTilt, ytDlpHelper } from "../utils/yt-dlp-util.js";
-import { textArrayToMakeForward } from "../utils/yunzai-util.js";
+import { textArrayToMakeForward, sendMusicCard } from "../utils/yunzai-util.js";
export class tools extends plugin {
/**
@@ -1701,6 +1702,7 @@ export class tools extends plugin {
if (/mv\?/.test(message)) {
const AUTO_NETEASE_MV_DETAIL = autoSelectNeteaseApi + "/mv/detail?mvid={}";
const AUTO_NETEASE_MV_URL = autoSelectNeteaseApi + "/mv/url?id={}";
+
// logger.info(AUTO_NETEASE_MV_DETAIL.replace("{}", id));
// logger.info(AUTO_NETEASE_MV_URL.replace("{}", id));
const [mvDetailData, mvUrlData] = await Promise.all([
@@ -1726,6 +1728,7 @@ export class tools extends plugin {
});
return;
}
+ const songWikiUrl = autoSelectNeteaseApi + '/song/wiki/summary?id=' + id
// 国内解决方案,替换为国内API (其中,NETEASE_API_CN是国内基址)
const AUTO_NETEASE_SONG_DOWNLOAD = autoSelectNeteaseApi + "/song/url/v1?id={}&level=" + this.neteaseCloudAudioQuality;
const AUTO_NETEASE_SONG_DETAIL = autoSelectNeteaseApi + "/song/detail?ids={}";
@@ -1769,16 +1772,55 @@ export class tools extends plugin {
const AudioLevel = translateToChinese(resp.data.data?.[0]?.level)
const AudioSize = bytesToMB(resp.data.data?.[0]?.size)
// 获取歌曲信息
- let title = await axios.get(detailUrl).then(res => {
- // logger.info('歌曲详情---', res.data.songs[0])
+ let { songName, artistName } = await axios.get(detailUrl).then(res => {
const song = res.data.songs[0];
- return cleanFilename(`${song?.name}-${song?.ar?.[0].name}`);
+ return {
+ songName: cleanFilename(song?.name),
+ artistName: cleanFilename(song?.ar?.[0].name)
+ };
});
+ let title = songName + '-' + artistName
// 获取歌曲封面
let coverUrl = await axios.get(detailUrl).then(res => {
const song = res.data.songs[0];
return song?.al?.picUrl
});
+ let typelist = []
+ // 歌曲百科API
+ await axios.get(songWikiUrl, {
+ headers: {
+ "User-Agent": COMMON_USER_AGENT,
+ // "Cookie": this.neteaseCookie
+ },
+ }).then(res => {
+ const wikiData = res.data.data.blocks[1].creatives
+ typelist.push(wikiData[0].resources[0].uiElement.mainTitle.title)
+ // 防止数据过深出错
+ const recTags = wikiData[1]
+ if (recTags.resources[0]) {
+ for (let i = 0; i < Math.min(3, recTags.resources.length); i++) {
+ if (recTags.resources[i] && recTags.resources[i].uiElement && recTags.resources[i].uiElement.mainTitle.title) {
+ typelist.push(recTags.resources[i].uiElement.mainTitle.title)
+ }
+ }
+ } else {
+ if (recTags.uiElement.textLinks[0].text) typelist.push(recTags.uiElement.textLinks[0].text)
+ }
+
+ if (wikiData[2].uiElement.mainTitle.title == 'BPM') {
+ typelist.push('BPM ' + wikiData[2].uiElement.textLinks[0].text)
+ } else {
+ typelist.push(wikiData[2].uiElement.textLinks[0].text)
+ }
+ typelist.push(AudioLevel)
+ })
+ let musicInfo = {
+ 'cover': coverUrl,
+ 'songName': songName,
+ 'singerName': artistName,
+ 'size': AudioSize + " MB",
+ 'musicType': typelist
+ }
// 一般这个情况是VIP歌曲 (如果没有url或者是国内,公用接口暂时不可用,必须自建并且ck可用状态才能进行高质量解析)
if (!isCkExpired || url == null) {
url = await this.musicTempApi(e, title, "网易云音乐");
@@ -1788,20 +1830,23 @@ export class tools extends plugin {
if (AudioLevel == '杜比全景声') {
audioInfo += '\n(杜比下载文件为MP4,编码格式为AC-4,需要设备支持才可播放)';
}
- e.reply([segment.image(coverUrl), `${this.identifyPrefix}识别:网易云音乐,${title}\n当前下载音质: ${audioInfo}\n预估大小: ${AudioSize}MB`]);
+ const data = await new NeteaseMusicInfo(e).getData(musicInfo)
+ let img = await puppeteer.screenshot("neteaseMusicInfo", data);
+ await e.reply(img);
+ // e.reply([segment.image(coverUrl), `${this.identifyPrefix}识别:网易云音乐,${title}\n当前下载音质: ${audioInfo}\n预估大小: ${AudioSize}MB`]);
}
// 动态判断后缀名
let musicExt = resp.data.data?.[0]?.type
// 下载音乐
downloadAudio(url, this.getCurDownloadPath(e), title, 'follow', musicExt).then(async path => {
+ // 发送群文件
+ await this.uploadGroupFile(e, path);
+ // 删除文件
+ await checkAndRemoveFile(path);
// 发送语音
if (musicExt != 'mp4' && this.isSendVocal) {
await e.reply(segment.record(path));
}
- // 上传群文件
- await this.uploadGroupFile(e, path);
- // 删除文件
- await checkAndRemoveFile(path);
}).catch(err => {
logger.error(`下载音乐失败,错误信息为: ${err}`);
});
@@ -1810,7 +1855,7 @@ export class tools extends plugin {
}
// 临时接口
- async musicTempApi(e, title, musicType) {
+ async musicTempApi(e, title, musicType, musicInfo = {}) {
let musicReqApi = NETEASE_TEMP_API;
if (musicType === "QQ音乐") {
musicReqApi = QQ_MUSIC_TEMP_API;
@@ -1823,11 +1868,32 @@ export class tools extends plugin {
"User-Agent": COMMON_USER_AGENT,
},
});
- const messageTitle = title + "\nR插件检测到当前为VIP音乐,正在转换...";
+ // const messageTitle = title + "\nR插件检测到当前为VIP音乐,正在转换...";
// ??后的内容是适配`QQ_MUSIC_TEMP_API`、最后是汽水
const url = vipMusicData.data?.music_url ?? vipMusicData.data?.data?.music_url ?? vipMusicData.data?.music;
const cover = vipMusicData.data?.cover ?? vipMusicData.data?.data?.cover ?? vipMusicData.data?.cover;
- await e.reply([segment.image(cover), `${ this.identifyPrefix }识别:${ musicType },${ messageTitle }`]);
+ const name = vipMusicData.data?.title ?? vipMusicData.data?.data?.song_name ?? vipMusicData.data?.title;
+ const singer = vipMusicData.data?.singer ?? vipMusicData.data?.data?.song_singer ?? vipMusicData.data?.singer;
+ const id = vipMusicData.data?.id ?? vipMusicData.data?.data?.quality ?? vipMusicData.data?.pay;
+ if (musicType === "网易云音乐") {
+ musicInfo.size = id
+ musicInfo.musicType = musicInfo.musicType.slice(0, -1)
+ const data = await new NeteaseMusicInfo(e).getData(musicInfo)
+ let img = await puppeteer.screenshot("neteaseMusicInfo", data);
+ await e.reply(img);
+ } else {
+ musicInfo = {
+ 'cover': cover,
+ 'songName': name,
+ 'singerName': singer,
+ 'size': id,
+ 'musicType': ""
+ }
+ const data = await new NeteaseMusicInfo(e).getData(musicInfo)
+ let img = await puppeteer.screenshot("neteaseMusicInfo", data);
+ await e.reply(img);
+ }
+ // await e.reply([segment.image(cover), `${this.identifyPrefix}识别:${musicType},${messageTitle}`]);
return url;
}
@@ -1859,13 +1925,13 @@ export class tools extends plugin {
"User-Agent": COMMON_USER_AGENT,
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"cookie": "_T_WM=40835919903; WEIBOCN_FROM=1110006030; MLOGIN=0; XSRF-TOKEN=4399c8",
- "Referer": `https://m.weibo.cn/detail/${ id }`,
+ "Referer": `https://m.weibo.cn/detail/${id}`,
}
})
.then(async resp => {
const wbData = resp.data.data;
const { text, status_title, source, region_name, pics, page_info } = wbData;
- e.reply(`${ this.identifyPrefix }识别:微博,${ text.replace(/<[^>]+>/g, '') }\n${ status_title }\n${ source }\t${ region_name ?? '' }`);
+ e.reply(`${this.identifyPrefix}识别:微博,${text.replace(/<[^>]+>/g, '')}\n${status_title}\n${source}\t${region_name ?? ''}`);
if (pics) {
// 下载图片并格式化消息
const imagesPromise = pics.map(item => {
From 08b4d5d652bd958cecd104aef52455e76e29149d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A7=8B=E5=88=80=E9=B1=BC?=
<9903082+qdyovo@user.noreply.gitee.com>
Date: Thu, 7 Nov 2024 17:28:35 +0800
Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=A6=84=20reactor:=20=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E9=80=82=E9=85=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/tools.js | 2 +-
guoba.support.js | 2 +-
.../neteaseMusicInfo/neteaseMusicInfo.css | 22 ++++++----
.../neteaseMusicInfo/neteaseMusicInfo.html | 42 ++++++++++---------
4 files changed, 38 insertions(+), 30 deletions(-)
diff --git a/apps/tools.js b/apps/tools.js
index 833c918..89fdf90 100644
--- a/apps/tools.js
+++ b/apps/tools.js
@@ -1823,7 +1823,7 @@ export class tools extends plugin {
}
// 一般这个情况是VIP歌曲 (如果没有url或者是国内,公用接口暂时不可用,必须自建并且ck可用状态才能进行高质量解析)
if (!isCkExpired || url == null) {
- url = await this.musicTempApi(e, title, "网易云音乐");
+ url = await this.musicTempApi(e, title, "网易云音乐", musicInfo);
} else {
// 拥有ck,并且有效,直接进行解析
let audioInfo = AudioLevel;
diff --git a/guoba.support.js b/guoba.support.js
index 6551c6b..5b61425 100644
--- a/guoba.support.js
+++ b/guoba.support.js
@@ -265,7 +265,7 @@ export function supportGuoba() {
},
{
field: "tools.isSendVocal",
- label: "网易云开启仅发送音频",
+ label: "网易云开启发送音频",
bottomHelpMessage:
"默认开启,识别音乐之后是否转化群语音发送,关闭将获得一定的性能提升",
component: "Switch",
diff --git a/resources/html/neteaseMusicInfo/neteaseMusicInfo.css b/resources/html/neteaseMusicInfo/neteaseMusicInfo.css
index def1ce0..9a4b2b5 100644
--- a/resources/html/neteaseMusicInfo/neteaseMusicInfo.css
+++ b/resources/html/neteaseMusicInfo/neteaseMusicInfo.css
@@ -10,7 +10,6 @@ html {
margin: 0;
padding: 0;
width: 780px;
- height: 370px;
font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
@@ -20,7 +19,7 @@ html {
top: 0;
left: 0;
width: 780px;
- height:450px;
+ height: 450px;
z-index: -1;
object-fit: cover;
}
@@ -44,6 +43,12 @@ html {
box-sizing: border-box;
}
+.songinfobox {
+ width: 100%;
+ height: 100%;
+ padding: 30px 0px;
+}
+
.info {
width: 100%;
height: 100%;
@@ -54,7 +59,6 @@ html {
}
.cover {
- margin-top: 28px;
width: 100%;
height: 135px;
display: flex;
@@ -68,7 +72,7 @@ html {
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
}
-.songSize{
+.songSize {
width: 100%;
text-align: center;
margin-top: 20px;
@@ -87,7 +91,7 @@ html {
text-shadow: 2px 2px 5px rgba(255, 255, 255, 0.4);
}
-.singerName{
+.singerName {
width: 100%;
text-align: center;
font-family: 'singerName';
@@ -97,23 +101,23 @@ html {
text-shadow: 2px 2px 5px rgba(255, 255, 255, 0.4);
}
-.typeBox{
+.typeBox {
width: 100%;
margin-top: 22px;
display: flex;
justify-content: center;
}
-.typeList{
+.typeList {
display: flex;
}
-.typeNav{
+.typeNav {
font-size: 15px;
height: 25px;
padding: 0px 10px;
box-sizing: border-box;
- background-color:rgba(255, 255, 255, 0.2);
+ background-color: rgba(255, 255, 255, 0.2);
line-height: 0px;
display: flex;
justify-content: center;
diff --git a/resources/html/neteaseMusicInfo/neteaseMusicInfo.html b/resources/html/neteaseMusicInfo/neteaseMusicInfo.html
index 9fe0724..9e34edd 100644
--- a/resources/html/neteaseMusicInfo/neteaseMusicInfo.html
+++ b/resources/html/neteaseMusicInfo/neteaseMusicInfo.html
@@ -17,26 +17,30 @@
-
-

-
-
- {{ songInfo.size }} MB
-
-
- {{ songInfo.songName }}
-
-
- {{ songInfo.singerName }}
-
-
-
- {{each songInfo.musicType typeName}}
-
- {{ typeName }}
-
- {{ /each }}
+
+
+
+
+ {{ songInfo.size }}
+
+
+ {{ songInfo.songName }}
+
+
+ {{ songInfo.singerName }}
+
+ {{if songInfo.musicType}}
+
+
+ {{each songInfo.musicType typeName}}
+
+ {{ typeName || '喵喵~'}}
+
+ {{ /each }}
+
+
+ {{/if}}
From c2ddab4048bdc558aeee379e4840b4b676337c3a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A7=8B=E5=88=80=E9=B1=BC?=
<9903082+qdyovo@user.noreply.gitee.com>
Date: Fri, 8 Nov 2024 09:17:07 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=A6=84=20reactor:=20=E6=8F=92?=
=?UTF-8?q?=E4=BB=B6=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../html/neteaseMusicInfo/neteaseMusicInfo.css | 15 ++++++++++++---
.../html/neteaseMusicInfo/neteaseMusicInfo.html | 1 +
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/resources/html/neteaseMusicInfo/neteaseMusicInfo.css b/resources/html/neteaseMusicInfo/neteaseMusicInfo.css
index 9a4b2b5..5795200 100644
--- a/resources/html/neteaseMusicInfo/neteaseMusicInfo.css
+++ b/resources/html/neteaseMusicInfo/neteaseMusicInfo.css
@@ -9,7 +9,7 @@ body,
html {
margin: 0;
padding: 0;
- width: 780px;
+ width: 100%;
font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
@@ -18,7 +18,7 @@ html {
position: absolute;
top: 0;
left: 0;
- width: 780px;
+ width: 100%;
height: 450px;
z-index: -1;
object-fit: cover;
@@ -46,7 +46,7 @@ html {
.songinfobox {
width: 100%;
height: 100%;
- padding: 30px 0px;
+ padding: 30px 0px 17px 0px;
}
.info {
@@ -126,4 +126,13 @@ html {
margin-left: 10px;
color: #fff;
box-shadow: 0px 0px 3px rgba(255, 255, 255, 0.4);
+}
+
+.logo{
+ width: 100%;
+ text-align: center;
+ font-size: 15px;
+ margin-top: 20px;
+ color: rgba(255, 255, 255, 0.7);
+ font-family: 'singerName';
}
\ No newline at end of file
diff --git a/resources/html/neteaseMusicInfo/neteaseMusicInfo.html b/resources/html/neteaseMusicInfo/neteaseMusicInfo.html
index 9e34edd..f886fe2 100644
--- a/resources/html/neteaseMusicInfo/neteaseMusicInfo.html
+++ b/resources/html/neteaseMusicInfo/neteaseMusicInfo.html
@@ -41,6 +41,7 @@
{{/if}}
+ Created By Yunzai-Bot & R-Plugin
From 5bf9b4885fb0aa5b7bef4835cfd557e25f74bed9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A7=8B=E5=88=80=E9=B1=BC?=
<9903082+qdyovo@user.noreply.gitee.com>
Date: Fri, 8 Nov 2024 09:21:06 +0800
Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=A6=84=20reactor:=20=E5=BE=AE?=
=?UTF-8?q?=E8=B0=83UI?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
resources/html/neteaseMusicInfo/neteaseMusicInfo.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/html/neteaseMusicInfo/neteaseMusicInfo.css b/resources/html/neteaseMusicInfo/neteaseMusicInfo.css
index 5795200..825c8fe 100644
--- a/resources/html/neteaseMusicInfo/neteaseMusicInfo.css
+++ b/resources/html/neteaseMusicInfo/neteaseMusicInfo.css
@@ -46,7 +46,7 @@ html {
.songinfobox {
width: 100%;
height: 100%;
- padding: 30px 0px 17px 0px;
+ padding: 25px 0px 17px 0px;
}
.info {