diff --git a/apps/tools.js b/apps/tools.js index 083c9fe..dec7ac8 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -1324,75 +1324,6 @@ export class tools extends plugin { }) } - // pixivision 解析 - async pixivision(e) { - let msg = /https:\/\/www\.pixivision\.net\/zh\/a\/(\d+)/.exec(e.msg)[0]; - if (!msg) { - e.reply("pixivision 无法获取到信息"); - return; - } - fetch(msg, { - 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", - } - }).then(async resp => { - const html = await resp.text(); - // 正则表达式来匹配包含特定类名的img标签,并捕获src属性的值 - const regex = /]*src="([^"]*)"[^>]*class="[^"]*am__work__illust[^"]*"[^>]*>/g; - - let matches; - const srcs = []; - // 获取图片信息 - while ((matches = regex.exec(html)) !== null) { - // matches[1] 是正则表达式中第一个括号捕获的内容,即src属性的值 - srcs.push(matches[1]); - } - // 获取下载路径 - const curPath = this.getCurDownloadPath(e); - // 下载图片 - Promise.all(srcs.map((item) => { - return new Promise((resolve, reject) => { // 使用新的Promise来控制异步流程 - axios.get(item, { - responseType: 'stream', - 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", - "Referer": "https://www.pixiv.net/", - } - }).then(response => { - const downloadPath = `${ curPath }/${ item.split('/').pop() }`; - const writer = fs.createWriteStream(downloadPath); - response.data.pipe(writer); - writer.on('finish', () => resolve(downloadPath)); // 在文件写入完成后解决Promise - writer.on('error', reject); // 监听错误事件 - }).catch(reject); // 处理axios请求的错误 - }); - })).then(path => { - // 在这里,path数组包含的是所有下载并成功写入的文件路径 - // 你可以在这里执行e.reply,此时所有文件都已经准备好了 - try { - // 假设e.reply返回一个Promise - e.reply(Bot.makeForwardMsg(path.map(item => ({ - message: segment.image(fs.readFileSync(item)), - nickname: this.e.sender.card || this.e.user_id, - user_id: this.e.user_id, - })))); - - // 删除文件操作 - path.forEach(item => { - try { - fs.unlinkSync(item); - } catch (err) { - logger.error(`删除文件${ item }失败,请使用命令”清理data垃圾“进行清理`, err); - } - }); - } catch (error) { - logger.error(`发送消息失败`, error); - } - }); - }); - return true; - } - // 微视 async weishi(e) { // 拦截恶意链接 【后续如果有小程序检测可以删除这个逻辑】 diff --git a/config/help.yaml b/config/help.yaml index 179516a..bcdebbe 100644 --- a/config/help.yaml +++ b/config/help.yaml @@ -33,10 +33,10 @@ title: "翻中/英/日 xxx" desc: R插件翻译引擎 - icon: tiktok - title: "xxxv.douyin.com" + title: "douyin" desc: 抖音分享实时下载 - icon: bilibili - title: "bilibili/b23" + title: "哔哩哔哩" desc: 哔哩哔哩分享实时下载 - icon: bqrcode title: "#rbq/#RBQ" @@ -45,7 +45,7 @@ title: "Apple Music" desc: Apple Music音乐分享实时下载 - icon: youtube - title: "youtube.com" + title: "油管" desc: 油管学习版分享实时下载 - icon: 推特 title: "小蓝鸟" @@ -68,9 +68,6 @@ - icon: weibo title: "微博" desc: 微博文章分享实时下载 - - icon: pixv - title: "pixivision" - desc: pixivision分享实时下载 - icon: zuiyou title: "最右(测试阶段)" desc: 最右分享实时下载 diff --git a/resources/img/icon/pixv.png b/resources/img/icon/pixv.png deleted file mode 100644 index cfa5340..0000000 Binary files a/resources/img/icon/pixv.png and /dev/null differ