From 851e486b36accfa1ab4e2ac6cbc32562105c23fd Mon Sep 17 00:00:00 2001 From: zhiyu1998 <542716863@qq.com> Date: Sun, 20 Nov 2022 23:26:55 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=88=20style:=20=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/help.js | 4 ++-- apps/tools.js | 24 ++++++++++++++++++++++++ config/help.yaml | 10 +++++----- index.js | 4 ++-- model/base.js | 8 ++++---- model/index.js | 2 +- 6 files changed, 38 insertions(+), 14 deletions(-) diff --git a/apps/help.js b/apps/help.js index cd6942e..14ffd0f 100644 --- a/apps/help.js +++ b/apps/help.js @@ -10,8 +10,8 @@ let helpData = { export class help extends plugin { constructor (e) { super({ - name: 'RConsole插件帮助', - dsc: 'RConsole插件帮助插件帮助', + name: 'rconsole插件帮助', + dsc: 'rconsole插件帮助插件帮助', event: 'message', priority: 500, rule: [ diff --git a/apps/tools.js b/apps/tools.js index 9ab73e9..0b90397 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -27,4 +27,28 @@ export class tools extends plugin { .catch((err) => logger.error(err)) return true } + + // 抖音解析 + async douyin(e) { + const urlRex = /(http:|https:)\/\/v.douyin.com\/[A-Za-z\\d._?%&+\-=\/#]*/g + puppeteer.launch().then(async browser => { + const page = await browser.newPage(); + await page.goto(urlRex.exec(e.msg.trim())[0]); + const headers = page.headers() + console.log(headers) + await browser.close(); + }); + const douyinRex = /.*video\/(\d+)\/(.*?)/g + const resolver = douyinRex.exec(location) + const url = `https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=${resolver}` + e.reply('解析中...') + const res = fetch(url, { + headers: { + 'User-Agent': "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Mobile Safari/537.36" + }, + timeout: 10000 + }).then(resp => { + return resp.body + }) + } } diff --git a/config/help.yaml b/config/help.yaml index 2b2165f..aba88f6 100644 --- a/config/help.yaml +++ b/config/help.yaml @@ -44,11 +44,11 @@ - group: 其他指令[实验] list: - icon: 问号 - title: "#RConsole插件版本" + title: "#rconsole插件版本" desc: "查看,最近维护的版本信息" - icon: 史莱姆 - title: "#RConsole插件更新" - desc: "进行更新RConsole插件" + title: "#rconsole插件更新" + desc: "进行更新rconsole插件" - icon: 原石 - title: "#RConsole插件强制更新" - desc: "进行强制更新RConsole插件" \ No newline at end of file + title: "#rconsole插件强制更新" + desc: "进行强制更新rconsole插件" \ No newline at end of file diff --git a/index.js b/index.js index e049a3b..95ed81e 100644 --- a/index.js +++ b/index.js @@ -4,12 +4,12 @@ import RConfig from './model/index.js' const versionData = RConfig.getConfig('version') logger.info('--------------------------') -logger.info(`RConsole插件${versionData[0].version}初始化~`) +logger.info(`rconsole插件${versionData[0].version}初始化~`) logger.info('--------------------------') // 读取功能 const files = fs - .readdirSync('./plugins/RConsole-plugin/apps') + .readdirSync('./plugins/rconsole-plugin/apps') .filter((file) => file.endsWith('.js')) let apps = {} diff --git a/model/base.js b/model/base.js index 58ea559..ef3f345 100644 --- a/model/base.js +++ b/model/base.js @@ -2,12 +2,12 @@ export default class base { constructor (e = {}) { this.e = e this.userId = e?.user_id - this.model = 'RConsole-plugin' + this.model = 'rconsole-plugin' this._path = process.cwd().replace(/\\/g, '/') } get prefix () { - return `Yz:RConsole-plugin:${this.model}:` + return `Yz:rconsole-plugin:${this.model}:` } /** @@ -19,9 +19,9 @@ export default class base { get screenData () { return { saveId: this.userId, - tplFile: `./plugins/RConsole-plugin/resources/html/${this.model}/${this.model}.html`, + tplFile: `./plugins/rconsole-plugin/resources/html/${this.model}/${this.model}.html`, /** 绝对路径 */ - pluResPath: `${this._path}/plugins/RConsole-plugin/resources/` + pluResPath: `${this._path}/plugins/rconsole-plugin/resources/` } } } diff --git a/model/index.js b/model/index.js index 1e52386..de078d9 100644 --- a/model/index.js +++ b/model/index.js @@ -6,7 +6,7 @@ import chokidar from 'chokidar' class RConfig { constructor () { // 配置文件 - this.configPath = './plugins/RConsole-plugin/config/' + this.configPath = './plugins/rconsole-plugin/config/' this.config = {} // 监听文件