diff --git a/apps/tools.js b/apps/tools.js index 0cf3e54..bdba5bc 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -51,7 +51,7 @@ import { TWITTER_TWEET_INFO, XHS_REQ_LINK, XHS_VIDEO, - GENERAL_REQ_LINK, WEIBO_SINGLE_INFO + GENERAL_REQ_LINK, WEIBO_SINGLE_INFO, WEISHI_VIDEO_INFO } from "../constants/tools.js"; import child_process from 'node:child_process' import { getAudio, getVideo } from "../utils/y2b.js"; @@ -150,6 +150,10 @@ export class tools extends plugin { { reg: "(pixivision.net)", fnc: "pixivision" + }, + { + reg: "(isee.weishi.qq.com)", + fnc: "weishi" } ], }); @@ -1251,6 +1255,52 @@ export class tools extends plugin { return true; } + // 微视 + async weishi(e) { + // 拦截恶意链接 【后续如果有小程序检测可以删除这个逻辑】 + if (!e.msg.includes('https://isee.weishi.qq.com/ws/app-pages/share/index.html')) { + e.reply("识别:微视,但无法完整检测到视频ID"); + // 打个日志 方便后面出bug知道位置 + logger.error("[R插件][微视] 无法检测链接") + return true; + } + + const url = e.msg; + try { + const idMatch = url.match(/id=(.*)&spid/); + if (!idMatch || idMatch.length !== 2) { + e.reply("识别:微视,但无法完整检测到视频ID"); + // 打个日志 方便后面出bug知道位置 + logger.error("[R插件][微视] 无法检测到ID,逻辑大概问题在正则表达式") + return true; + } + + const feedId = idMatch[1]; + const response = await axios.get(WEISHI_VIDEO_INFO.replace("{}", feedId), { + headers: { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36", + } + }); + + const weishiResponse = response.data; + const firstFeed = weishiResponse.data.feeds[0]; + // 标题、封面、视频链接 + const title = firstFeed.feed_desc; + const cover = firstFeed.images[0].url; + const noWatermarkDownloadUrl = firstFeed.video_url; + + e.reply([segment.image(cover), `识别:微视,${ title }`]); + + this.downloadVideo(noWatermarkDownloadUrl).then(path => { + e.reply(segment.video(path + "/temp.mp4")); + }); + } catch (err) { + logger.error(err); + return true; + } + return true; + } + /** * 哔哩哔哩下载 * @param title diff --git a/config/version.yaml b/config/version.yaml index fc6c5ea..b7e5b44 100644 --- a/config/version.yaml +++ b/config/version.yaml @@ -1,12 +1,10 @@ - { - version: 1.5.11, + version: 1.5.12, data: [ + 新增微视解析功能, 新增小世界解析功能, 新增贴吧解析功能, - 优化哔哩哔哩简介功能, - 新增皮皮搞笑解析功能, - 新增皮皮虾解析功能, 支持锅巴插件,方便查看和修改配置, 添加#R帮助获取插件帮助, 添加#R版本获取插件版本, diff --git a/constants/tools.js b/constants/tools.js index a40a3a2..12b14db 100644 --- a/constants/tools.js +++ b/constants/tools.js @@ -94,16 +94,22 @@ export const GENERAL_REQ_LINK_2 = { * 获取网易云歌曲下载链接 * @type {string} */ -export const NETEASE_SONG_DOWNLOAD = "https://www.oranges1.top/neteaseapi.do/song/url?id={}" +export const NETEASE_SONG_DOWNLOAD = "https://neteasecloudmusicapi.vercel.app/song/url?id={}" /** * 获取网易云歌曲详情 * @type {string} */ -export const NETEASE_SONG_DETAIL = "https://www.oranges1.top/neteaseapi.do/song/detail?ids={}" +export const NETEASE_SONG_DETAIL = "https://neteasecloudmusicapi.vercel.app/song/detail?ids={}" /** * 单条微博的接口 * @type {string} */ export const WEIBO_SINGLE_INFO = "https://m.weibo.cn/statuses/show?id={}" + +/** + * 微视接口 + * @type {string} + */ +export const WEISHI_VIDEO_INFO = "https://h5.weishi.qq.com/webapp/json/weishi/WSH5GetPlayPage?feedid={}"