kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: detect capacity limit
rodzic
658be86e24
commit
1dc12afe7d
|
@ -67,6 +67,11 @@ export async function getOpenAIAuth2Captcha({
|
||||||
// NOTE: this is where you may encounter a CAPTCHA
|
// NOTE: this is where you may encounter a CAPTCHA
|
||||||
await page.solveRecaptchas()
|
await page.solveRecaptchas()
|
||||||
|
|
||||||
|
var capacityLimit = await page.$('[role="alert"]')
|
||||||
|
if (capacityLimit) {
|
||||||
|
throw `ChatGPT is at capacity right now`
|
||||||
|
}
|
||||||
|
|
||||||
await page.waitForSelector('#__next .btn-primary', { timeout: timeoutMs })
|
await page.waitForSelector('#__next .btn-primary', { timeout: timeoutMs })
|
||||||
|
|
||||||
// once we get to this point, the Cloudflare cookies are available
|
// once we get to this point, the Cloudflare cookies are available
|
||||||
|
@ -91,10 +96,6 @@ export async function getOpenAIAuth2Captcha({
|
||||||
waitUntil: 'networkidle0'
|
waitUntil: 'networkidle0'
|
||||||
})
|
})
|
||||||
])
|
])
|
||||||
/*var capacityLimit = await page.$('')
|
|
||||||
if (capacityLimit) {
|
|
||||||
throw `ChatGPT is at capacity right now`
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const pageCookies = await page.cookies()
|
const pageCookies = await page.cookies()
|
||||||
|
|
|
@ -62,6 +62,10 @@ export async function getOpenAIAuth({
|
||||||
await page.goto('https://chat.openai.com/auth/login')
|
await page.goto('https://chat.openai.com/auth/login')
|
||||||
|
|
||||||
// NOTE: this is where you may encounter a CAPTCHA
|
// NOTE: this is where you may encounter a CAPTCHA
|
||||||
|
var capacityLimit = await page.$('[role="alert"]')
|
||||||
|
if (capacityLimit) {
|
||||||
|
throw `ChatGPT is at capacity right now`
|
||||||
|
}
|
||||||
|
|
||||||
await page.waitForSelector('#__next .btn-primary', { timeout: timeoutMs })
|
await page.waitForSelector('#__next .btn-primary', { timeout: timeoutMs })
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue