diff --git a/package.json b/package.json index 33c2289..3abeb8a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-image-search", "description": "Image searching plugin for Koishi", - "version": "4.2.3", + "version": "4.2.4", "main": "lib/index.js", "typings": "lib/index.d.ts", "files": [ @@ -42,7 +42,7 @@ } }, "peerDependencies": { - "koishi": "^4.16.3" + "koishi": "^4.17.0" }, "dependencies": { "cheerio": "^1.0.0-rc.12", @@ -51,7 +51,7 @@ }, "devDependencies": { "@types/node": "^20.10.2", - "koishi": "^4.16.3", + "koishi": "^4.17.0", "typescript": "^5.3.2" } } diff --git a/src/ascii2d.ts b/src/ascii2d.ts index 9129d93..fff222a 100644 --- a/src/ascii2d.ts +++ b/src/ascii2d.ts @@ -1,7 +1,6 @@ import { load } from 'cheerio' import { Logger, Quester, Session } from 'koishi' import { Config, getShareText, OutputConfig } from './utils' -import FormData from 'form-data' const baseURL = 'https://ascii2d.net' const logger = new Logger('search') @@ -9,12 +8,9 @@ const logger = new Logger('search') export default async function (http: Quester, url: string, session: Session, config: Config) { try { const tasks: Promise[] = [] - const form = new FormData() - form.append('file', await http.get(url, { responseType: 'stream' })) - const colorHTML = await http.post(`${baseURL}/search/file`, form, { + const colorHTML = await http.get(`${baseURL}/search/url/${encodeURIComponent(url)}`,{ headers: { - 'User-Agent': 'PostmanRuntime/7.29.0', - ...form.getHeaders(), + 'User-Agent': 'PostmanRuntime/7.29.0', }, }) tasks.push(session.send('ascii2d 色合检索\n' + getDetail(colorHTML, config.output)))