mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
必应验证码解决方案 (#528)
* feat: 必应验证码另一个解决方案 * fix: add log * fix: try try * fix: 优化报错信息
This commit is contained in:
parent
709a1cebf0
commit
e445cb3c7f
4 changed files with 75 additions and 45 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import fetch from 'node-fetch'
|
||||
|
||||
// this file is deprecated
|
||||
|
||||
import { Config } from './config.js'
|
||||
import {Config} from './config.js'
|
||||
import HttpsProxyAgent from 'https-proxy-agent'
|
||||
|
||||
const newFetch = (url, options = {}) => {
|
||||
const defaultOptions = Config.proxy
|
||||
? {
|
||||
|
|
@ -60,3 +60,31 @@ export async function solveCaptcha (id, regionId, text, token) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function solveCaptchaOneShot (token) {
|
||||
if (!token) {
|
||||
throw new Error('no token')
|
||||
}
|
||||
let solveUrl = Config.bingCaptchaOneShotUrl
|
||||
if (!solveUrl) {
|
||||
throw new Error('no captcha source')
|
||||
}
|
||||
logger.info(`尝试解决token${token}的验证码`)
|
||||
let result = await fetch(solveUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
_U: token
|
||||
})
|
||||
})
|
||||
if (result.status === 200) {
|
||||
return await result.json()
|
||||
} else {
|
||||
return {
|
||||
success: false,
|
||||
error: result.statusText
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ const defaultConfig = {
|
|||
serpSource: 'ikechan8370',
|
||||
extraUrl: 'https://cpe.ikechan8370.com',
|
||||
smartMode: false,
|
||||
bingCaptchaOneShotUrl: 'http://bingcaptcha.ikechan8370.com/bing',
|
||||
version: 'v2.7.3'
|
||||
}
|
||||
const _path = process.cwd()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue