From 22415c75461da3acd03db5eb92f94d9f995b144b Mon Sep 17 00:00:00 2001 From: zhiyu1998 Date: Sun, 27 Nov 2022 16:09:25 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8Dtiktok?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E7=9A=84=E7=9F=AD=E5=8F=B7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tools.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/tools.js b/apps/tools.js index 9ece7b5..147865f 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -26,7 +26,7 @@ export class tools extends plugin { fnc: "douyin", }, { - reg: "(.*)(www.tiktok.com)", + reg: "(.*)(www.tiktok.com)|(vt.tiktok.com)", fnc: "tiktok", }, { @@ -86,9 +86,16 @@ export class tools extends plugin { // tiktok解析 async tiktok (e) { const urlRex = /(http:|https:)\/\/www.tiktok.com\/[A-Za-z\d._?%&+\-=\/#]*/g; - const url = urlRex.exec(e.msg.trim())[0] + const urlShortRex = /(http:|https:)\/\/vt.tiktok.com\/[A-Za-z\d._?%&+\-=\/#]*/g; + let url = e.msg.trim() + // 短号处理 + if (url.includes('vt.tiktok')) { + url = urlShortRex.exec(url)[0] + } else { + url = urlRex.exec(url)[0] + } - const tiktokApi = `https://api.douyin.wtf/api?url=${ url }&minimal=true` + const tiktokApi = `https://api.douyin.wtf/api?url=${ url }&minimal=true`; e.reply("识别:tiktok, 解析中..."); fetch(tiktokApi) .then(resp => resp.json()) @@ -105,8 +112,9 @@ export class tools extends plugin { const urlRex = /(http:|https:)\/\/www.bilibili.com\/[A-Za-z\d._?%&+\-=\/#]*/g; const bShortRex = /(http:|https:)\/\/b23.tv\/[A-Za-z\d._?%&+\-=\/#]*/g; let url = e.msg.trim() + // 短号处理 if (url.includes('b23.tv')) { - const bShortUrl = bShortRex.exec(e.msg.trim())[0] + const bShortUrl = bShortRex.exec(url)[0] await this.douyinRequest(bShortUrl).then((res) => { url = res.replace("m", "www") });