🔧 chore: 清理引用

- 引入child_process和qrcode模块
- 更新bilibili.js文件,增加exec和spawn的引用
- 更新tools.js文件,优化API列表格式
- 更新query.js文件,移除不必要的http库引用
- 更新common.js文件,修正urlTransformShortLink函数中的URL编码问题

BREAKING CHANGE: 引入新的模块和API,可能影响现有功能
This commit is contained in:
zhiyu1998 2024-09-03 23:12:24 +08:00
parent a38ef04d27
commit c61b520222
4 changed files with 11 additions and 12 deletions

View File

@ -1,5 +1,3 @@
// 主库
// http库
import axios from "axios";
import _ from "lodash";
import fetch from "node-fetch";

View File

@ -41,7 +41,9 @@ import {
MIYOUSHE_ARTICLE,
NETEASE_API_CN,
NETEASE_SONG_DOWNLOAD,
NETEASE_TEMP_API, PearAPI_CRAWLER, PearAPI_DEEPSEEK,
NETEASE_TEMP_API,
PearAPI_CRAWLER,
PearAPI_DEEPSEEK,
QISHUI_MUSIC_TEMP_API,
QQ_MUSIC_TEMP_API,
TWITTER_TWEET_INFO,
@ -1778,7 +1780,7 @@ export class tools extends plugin {
const llmCrawler = await fetch(PearAPI_CRAWLER.replace("{}", summaryLink));
const content = await (await llmCrawler.json())?.data;
const titleMatch = content.match(/Title:\s*(.*?)\n/)?.[1];
e.reply(`${ this.identifyPrefix } 识别:${ name } - ${titleMatch},正在为您总结,请稍等...`, true);
e.reply(`${ this.identifyPrefix } 识别:${ name } - ${ titleMatch },正在为您总结,请稍等...`, true);
const deepseekFreeSummary = await fetch(PearAPI_DEEPSEEK, {
method: "POST",
headers: {

View File

@ -1,8 +1,10 @@
import fs from "node:fs";
import axios from 'axios'
import { exec, spawn } from 'child_process';
import child_process from 'node:child_process'
import util from "util";
import fs from "node:fs";
import path from "path";
import qrcode from "qrcode"
import util from "util";
import {
BILI_BVID_TO_CID,
BILI_DYNAMIC,
@ -12,8 +14,6 @@ import {
BILI_VIDEO_INFO
} from "../constants/tools.js";
import { mkdirIfNotExists } from "./file.js";
import { exec, spawn } from 'child_process';
import qrcode from "qrcode"
export const BILI_HEADER = {
'User-Agent':
@ -548,4 +548,4 @@ function replaceP2PUrl(url) {
} catch (e) {
return url;
}
}
}

View File

@ -1,6 +1,5 @@
import axios from "axios";
import { exec } from "child_process";
import https from 'https';
import { HttpsProxyAgent } from 'https-proxy-agent';
import fetch from "node-fetch";
import fs from "node:fs";
@ -478,7 +477,7 @@ export function checkToolInCurEnv(someCommand) {
*/
export async function urlTransformShortLink(url) {
const data = {
url: `${encodeURI(url)}`
url: `${ encodeURI(url) }`
};
const resp = await fetch(SHORT_LINKS, {
@ -490,4 +489,4 @@ export async function urlTransformShortLink(url) {
body: JSON.stringify(data)
}).then(response => response.json());
return await resp.data.short_url;
}
}