From 37dbbd9384a3f94a61ad6c7b4de362c11020fabe Mon Sep 17 00:00:00 2001 From: zhiyu1998 <542716863@qq.com> Date: Sat, 11 May 2024 13:56:44 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=B0=8F=E8=93=9D=E9=B8=9F=E5=9B=BD=E5=86=85=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tools.js | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/apps/tools.js b/apps/tools.js index 8c67aba..f932c9c 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -695,20 +695,12 @@ export class tools extends plugin { // 使用现有api解析小蓝鸟 async twitter_x(e) { - // 判断海外 - const isOversea = await this.isOverseasServer(); - // 如果不是海外用户且没有梯子直接返回 - if (!isOversea && !(await testProxy(this.proxyAddr, this.proxyPort))) { - e.reply("检测到没有梯子,无法解析"); - return false; - } - // 配置参数及解析 const reg = /https?:\/\/x.com\/[0-9-a-zA-Z_]{1,20}\/status\/([0-9]*)/; const twitterUrl = reg.exec(e.msg)[0]; // 提取视频 const videoUrl = GENERAL_REQ_LINK.link.replace("{}", twitterUrl); - e.reply("识别:小蓝鸟"); + e.reply("识别:小蓝鸟学习版"); const config = { headers: { '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.7', @@ -726,21 +718,13 @@ export class tools extends plugin { }, timeout: 10000 // 设置超时时间 } - // 如果不是海外,则使用代理 - if (!isOversea) { - config.httpsAgent = tunnel.httpsOverHttp({ - proxy: { - host: this.proxyAddr, - port: this.proxyPort - }, - }); - } + axios.get(videoUrl, config).then(resp => { const url = resp.data.data?.url; if (url && (url.endsWith(".jpg") || url.endsWith(".png"))) { e.reply(segment.image(url)); } else { - this.downloadVideo(url, !isOversea).then(path => { + this.downloadVideo(url).then(path => { e.reply(segment.video(path + "/temp.mp4")); }); }