diff --git a/apps/tools.js b/apps/tools.js
index 4d24446..f75b9b4 100644
--- a/apps/tools.js
+++ b/apps/tools.js
@@ -7,7 +7,7 @@ import axios from "axios";
import _ from "lodash";
import tunnel from "tunnel";
import HttpProxyAgent from "https-proxy-agent";
-import { checkAndRemoveFile, deleteFolderRecursive, mkdirIfNotExists } from "../utils/file.js";
+import { checkAndRemoveFile, deleteFolderRecursive, mkdirIfNotExists, readCurrentDir } from "../utils/file.js";
import {
downloadBFile,
getBiliAudio,
@@ -35,7 +35,15 @@ import { av2BV } from "../utils/bilibili-bv-av-convert.js";
import querystring from "querystring";
import TokenBucket from "../utils/token-bucket.js";
import { getWbi } from "../utils/biliWbi.js";
-import { BILI_SUMMARY, DY_INFO, TIKTOK_INFO, TWITTER_TWEET_INFO, XHS_REQ_LINK, XHS_VIDEO } from "../constants/tools.js";
+import {
+ BILI_SUMMARY,
+ DY_INFO,
+ TIKTOK_INFO,
+ TWITTER_TWEET_INFO,
+ XHS_REQ_LINK,
+ XHS_VIDEO,
+ XIGUA_REQ_LINK
+} from "../constants/tools.js";
import child_process from 'node:child_process'
import { getAudio, getVideo } from "../utils/y2b.js";
import { processTikTokUrl } from "../utils/tiktok.js";
@@ -122,6 +130,10 @@ export class tools extends plugin {
{
reg: "(youtube.com)",
fnc: "y2b"
+ },
+ {
+ reg: "(ixigua.com)",
+ fnc: "xigua"
}
],
});
@@ -721,8 +733,9 @@ export class tools extends plugin {
async clearTrash(e) {
const dataDirectory = "./data/";
+ // 删除Yunzai遗留问题的合成视频垃圾文件
try {
- const files = await fs.promises.readdir(dataDirectory);
+ const files = await readCurrentDir(dataDirectory);
let dataClearFileLen = 0;
for (const file of files) {
// 如果文件名符合规则,执行删除操作
@@ -731,7 +744,8 @@ export class tools extends plugin {
dataClearFileLen++;
}
}
- const rTempFileLen = await deleteFolderRecursive(this.toolsConfig.defaultPath)
+ // 删除R插件临时文件
+ const rTempFileLen = await deleteFolderRecursive(this.defaultPath)
e.reply(
`数据统计:\n` +
`- 当前清理了${ dataDirectory }下总计:${ dataClearFileLen } 个垃圾文件\n` +
@@ -1010,6 +1024,41 @@ export class tools extends plugin {
}
}
+ async xigua(e) {
+ // 1. https://v.ixigua.com/ienrQ5bR/
+ // 2. https://www.ixigua.com/7270448082586698281
+ // 3. https://m.ixigua.com/video/7270448082586698281
+ const msg = /(?:https?:\/\/)?(www|v|m)\.ixigua\.com\/[A-Za-z\d._?%&+\-=\/#]*/g.exec(e.msg)[0];
+
+ const id = /ixigua\.com\/(\d+)/.exec(msg)[1] || /\/video\/(\d+)/.exec(msg)[1];
+ const videoReq = `https://www.ixigua.com/${ id }`;
+ const xiguaHeader = {
+ 'authority': 'ib.365yg.com',
+ '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',
+ 'accept-language': 'zh-CN,zh;q=0.9',
+ 'cache-control': 'no-cache',
+ 'pragma': 'no-cache',
+ 'sec-ch-ua': '"Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"',
+ 'sec-ch-ua-mobile': '?0',
+ 'sec-ch-ua-platform': '"macOS"',
+ 'sec-fetch-dest': 'document',
+ 'sec-fetch-mode': 'navigate',
+ 'sec-fetch-site': 'none',
+ 'sec-fetch-user': '?1',
+ 'upgrade-insecure-requests': '1',
+ 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36'
+ }
+ axios.get(XIGUA_REQ_LINK.replace("{}", videoReq), {
+ headers: xiguaHeader
+ }).then(resp => {
+ const url = resp.data.data.url;
+ this.downloadVideo(url).then(path => {
+ e.reply(segment.video(path + "/temp.mp4"));
+ });
+ })
+ return true
+ }
+
/**
* 哔哩哔哩下载
* @param title
diff --git a/config/version.yaml b/config/version.yaml
index cb0999d..984a807 100644
--- a/config/version.yaml
+++ b/config/version.yaml
@@ -1,11 +1,11 @@
- {
- version: 1.3.3,
+ version: 1.3.4,
data:
[
+ 新增🍉解析功能,
新增油管解析功能,
新增小红书无水印下载功能,
新增哔哩哔哩官方AI总结功能,
- 新增快手解析功能,
支持锅巴插件,方便查看和修改配置,
添加#R帮助获取插件帮助,
添加#R版本获取插件版本,
diff --git a/constants/tools.js b/constants/tools.js
index 7357b68..543188c 100644
--- a/constants/tools.js
+++ b/constants/tools.js
@@ -68,4 +68,10 @@ export const TWITTER_TWEET_INFO = "https://api.twitter.com/2/tweets?ids={}"
* XHS 的请求链接
* @type {string}
*/
-export const XHS_REQ_LINK = "https://www.xiaohongshu.com/explore/"
\ No newline at end of file
+export const XHS_REQ_LINK = "https://www.xiaohongshu.com/explore/"
+
+/**
+ * 🍉 的请求链接
+ * @type {string}
+ */
+export const XIGUA_REQ_LINK = "http://47.99.158.118/video-crack/v2/parse?content={}"
\ No newline at end of file
diff --git a/utils/common.js b/utils/common.js
index ec0ef90..54c2a6c 100644
--- a/utils/common.js
+++ b/utils/common.js
@@ -4,7 +4,7 @@ import axios from "axios";
import fs from "node:fs";
import fetch from "node-fetch";
import { mkdirIfNotExists } from "./file.js";
-import {TEN_THOUSAND} from "../constants/constant.js";
+import { TEN_THOUSAND } from "../constants/constant.js";
/**
* 请求模板
diff --git a/utils/file.js b/utils/file.js
index 382d282..ddf2c03 100644
--- a/utils/file.js
+++ b/utils/file.js
@@ -6,7 +6,7 @@ import path from "path";
* @param file
* @returns {Promise}
*/
-async function checkAndRemoveFile(file) {
+export async function checkAndRemoveFile(file) {
try {
await fs.promises.access(file);
await fs.promises.unlink(file);
@@ -23,7 +23,7 @@ async function checkAndRemoveFile(file) {
* @param dir
* @returns {Promise}
*/
-async function mkdirIfNotExists(dir) {
+export async function mkdirIfNotExists(dir) {
try {
await fs.promises.access(dir);
} catch (err) {
@@ -40,9 +40,9 @@ async function mkdirIfNotExists(dir) {
* @returns {Promise}
* @param folderPath
*/
-async function deleteFolderRecursive(folderPath) {
+export async function deleteFolderRecursive(folderPath) {
try {
- const files = await fs.promises.readdir(folderPath);
+ const files = await readCurrentDir(folderPath);
const actions = files.map(async (file) => {
const curPath = path.join(folderPath, file);
@@ -64,4 +64,17 @@ async function deleteFolderRecursive(folderPath) {
}
}
-export { checkAndRemoveFile, mkdirIfNotExists, deleteFolderRecursive }
\ No newline at end of file
+/**
+ * 读取当前文件夹的所有文件和文件夹
+ * @param path 路径
+ * @param printTree 是否打印树状图
+ * @returns {Promise<*>} 返回一个包含文件名的数组
+ */
+export async function readCurrentDir(path) {
+ try {
+ const files = await fs.promises.readdir(path);
+ return files;
+ } catch (err) {
+ logger.error(err);
+ }
+}
\ No newline at end of file