Commit 1dc12afe authored by Mrlolpro's avatar Mrlolpro

feat: detect capacity limit

parent 658be86e
......@@ -67,6 +67,11 @@ export async function getOpenAIAuth2Captcha({
// NOTE: this is where you may encounter a CAPTCHA
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 })
// once we get to this point, the Cloudflare cookies are available
......@@ -91,10 +96,6 @@ export async function getOpenAIAuth2Captcha({
waitUntil: 'networkidle0'
})
])
/*var capacityLimit = await page.$('')
if (capacityLimit) {
throw `ChatGPT is at capacity right now`
}*/
}
const pageCookies = await page.cookies()
......
......@@ -62,6 +62,10 @@ export async function getOpenAIAuth({
await page.goto('https://chat.openai.com/auth/login')
// 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 })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment