diff --git a/apps/profile/ProfileStat.js b/apps/profile/ProfileStat.js index 9722a2dd..3e80b946 100644 --- a/apps/profile/ProfileStat.js +++ b/apps/profile/ProfileStat.js @@ -2,8 +2,8 @@ import { Common } from '#miao' import { MysApi, Player, Character } from '#miao.models' import moment from 'moment' import lodash from 'lodash' -import axios from 'axios' import cheerio from 'cheerio' +import fetch from 'node-fetch' const ProfileStat = { async stat (e) { @@ -120,8 +120,7 @@ const ProfileStat = { const request_url = 'https://homdgcat.wiki/gi/CH/maze.js' let resData = false try { - const response = await axios.get(request_url, {timeout: 5000}) - resData = response.data + resData = await (await fetch(request_url)).text() } catch (error) { logger.error('请求失败:', error) return false // 直接返回以停止后续逻辑 @@ -180,8 +179,7 @@ const ProfileStat = { const request_url = 'https://wiki.biligame.com/ys/%E5%B9%BB%E6%83%B3%E7%9C%9F%E5%A2%83%E5%89%A7%E8%AF%97' try { // 发送 GET 请求 - const response = await axios.get(request_url, {timeout: 5000}); - const html = response.data; + const html = await (await fetch(request_url)).text() // 加载 HTML const $ = cheerio.load(html); @@ -209,8 +207,7 @@ const ProfileStat = { const request_url = `https://wiki.biligame.com/${links[mazeId]}` // 发送 GET 请求 - const response = await axios.get(request_url, {timeout: 5000}); - const html = response.data; + const html = await (await fetch(request_url)).text() // 加载 HTML const $ = cheerio.load(html); diff --git a/package.json b/package.json index 229719e0..1ee88e34 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,12 @@ "author": "Yoimiya-Kokomi", "description": "miao-plugin", "type": "module", - "scripts": { - }, + "scripts": {}, "dependencies": { - "image-size": "^1.0.2", - "axios": "^1.7.7" + "image-size": "^1.1.1" }, "devDependencies": { - "cheerio": "1.0.0-rc.12", + "cheerio": "1.0.0", "request": "^2.88.2" }, "imports": {