mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 08:09:19 +00:00
✨ feat: 新增Netease MV
识别(Beta)
This commit is contained in:
parent
7cf994f36c
commit
dac8ff5064
@ -1129,10 +1129,39 @@ export class tools extends plugin {
|
||||
}
|
||||
// 判断海外
|
||||
const isOversea = await this.isOverseasServer();
|
||||
// 自动选择 API
|
||||
const autoSelectNeteaseApi = isOversea ? NETEASE_SONG_DOWNLOAD : NETEASE_API_CN;
|
||||
// mv截断
|
||||
if (message.includes("mv")) {
|
||||
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([
|
||||
axios.get(AUTO_NETEASE_MV_DETAIL.replace("{}", id), {
|
||||
headers: {
|
||||
"User-Agent": COMMON_USER_AGENT,
|
||||
}
|
||||
}),
|
||||
axios.get(AUTO_NETEASE_MV_URL.replace("{}", id), {
|
||||
headers: {
|
||||
"User-Agent": COMMON_USER_AGENT,
|
||||
}
|
||||
})
|
||||
]);
|
||||
const { name: mvName, artistName: mvArtist, cover: mvCover } = mvDetailData.data?.data;
|
||||
e.reply([segment.image(mvCover), `识别:网易云MV,${ mvName } - ${ mvArtist }`]);
|
||||
// logger.info(mvUrlData.data)
|
||||
const { url: mvUrl } = mvUrlData.data?.data;
|
||||
this.downloadVideo(mvUrl).then(path => {
|
||||
this.sendVideoToUpload(e, `${ path }/temp.mp4`)
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 国内解决方案,替换为国内API (其中,NETEASE_API_CN是国内基址)
|
||||
const AUTO_NETEASE_SONG_DOWNLOAD = isOversea ? NETEASE_SONG_DOWNLOAD : `${ NETEASE_API_CN }/song/url?id={}`;
|
||||
const AUTO_NETEASE_SONG_DETAIL = isOversea ? NETEASE_SONG_DETAIL : `${ NETEASE_API_CN }/song/detail?ids={}`;
|
||||
logger.info(AUTO_NETEASE_SONG_DOWNLOAD.replace("{}", id));
|
||||
const AUTO_NETEASE_SONG_DOWNLOAD = autoSelectNeteaseApi + "/song/url?id={}";
|
||||
const AUTO_NETEASE_SONG_DETAIL = autoSelectNeteaseApi + "/song/detail?ids={}";
|
||||
// logger.info(AUTO_NETEASE_SONG_DOWNLOAD.replace("{}", id));
|
||||
// 请求netease数据
|
||||
axios.get(AUTO_NETEASE_SONG_DOWNLOAD.replace("{}", id), {
|
||||
headers: {
|
||||
|
@ -126,14 +126,14 @@ export const GENERAL_REQ_LINK_3 = {
|
||||
* 获取网易云歌曲下载链接
|
||||
* @type {string}
|
||||
*/
|
||||
export const NETEASE_SONG_DOWNLOAD = "https://neteasecloudmusicapi.vercel.app/song/url?id={}"
|
||||
export const NETEASE_SONG_DOWNLOAD = "https://neteasecloudmusicapi.vercel.app"
|
||||
|
||||
/**
|
||||
* 获取网易云歌曲详情
|
||||
* 致谢 NeteaseCloudMusicApi:https://gitlab.com/Binaryify/neteasecloudmusicapi
|
||||
* @type {string}
|
||||
*/
|
||||
export const NETEASE_SONG_DETAIL = "https://neteasecloudmusicapi.vercel.app/song/detail?ids={}"
|
||||
export const NETEASE_SONG_DETAIL = "https://neteasecloudmusicapi.vercel.app"
|
||||
|
||||
/**
|
||||
* 国内网易云服务,如果有大佬可以有闲置的服务器可以到群里赞助
|
||||
|
Loading…
x
Reference in New Issue
Block a user