mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🐞 fix: 修复tiktok解析的短号问题
This commit is contained in:
parent
b86b65b0c5
commit
22415c7546
@ -26,7 +26,7 @@ export class tools extends plugin {
|
|||||||
fnc: "douyin",
|
fnc: "douyin",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
reg: "(.*)(www.tiktok.com)",
|
reg: "(.*)(www.tiktok.com)|(vt.tiktok.com)",
|
||||||
fnc: "tiktok",
|
fnc: "tiktok",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -86,9 +86,16 @@ export class tools extends plugin {
|
|||||||
// tiktok解析
|
// tiktok解析
|
||||||
async tiktok (e) {
|
async tiktok (e) {
|
||||||
const urlRex = /(http:|https:)\/\/www.tiktok.com\/[A-Za-z\d._?%&+\-=\/#]*/g;
|
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, 解析中...");
|
e.reply("识别:tiktok, 解析中...");
|
||||||
fetch(tiktokApi)
|
fetch(tiktokApi)
|
||||||
.then(resp => resp.json())
|
.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 urlRex = /(http:|https:)\/\/www.bilibili.com\/[A-Za-z\d._?%&+\-=\/#]*/g;
|
||||||
const bShortRex = /(http:|https:)\/\/b23.tv\/[A-Za-z\d._?%&+\-=\/#]*/g;
|
const bShortRex = /(http:|https:)\/\/b23.tv\/[A-Za-z\d._?%&+\-=\/#]*/g;
|
||||||
let url = e.msg.trim()
|
let url = e.msg.trim()
|
||||||
|
// 短号处理
|
||||||
if (url.includes('b23.tv')) {
|
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) => {
|
await this.douyinRequest(bShortUrl).then((res) => {
|
||||||
url = res.replace("m", "www")
|
url = res.replace("m", "www")
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user