kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: minor improvements to captcha bypass
rodzic
d0506dad6b
commit
10db1601a0
|
@ -662,16 +662,21 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._browser) {
|
if (this._browser) {
|
||||||
const pages = await this._browser.pages()
|
try {
|
||||||
for (const page of pages) {
|
const pages = await this._browser.pages()
|
||||||
await page.close()
|
for (const page of pages) {
|
||||||
|
await page.close()
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('closeSession error', err)
|
||||||
}
|
}
|
||||||
|
|
||||||
await this._browser.close()
|
await this._browser.close()
|
||||||
|
|
||||||
|
const browserProcess = this._browser.process()
|
||||||
// Rule number 1 of zombie process hunting: double-tap
|
// Rule number 1 of zombie process hunting: double-tap
|
||||||
if (this._browser.process()) {
|
if (browserProcess) {
|
||||||
this._browser.process().kill('SIGINT')
|
browserProcess.kill('SIGKILL')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,12 +188,12 @@ export async function getOpenAIAuth({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await delay(1200)
|
await delay(2000)
|
||||||
const frame = page.mainFrame()
|
const frame = page.mainFrame()
|
||||||
const submit = await page.waitForSelector('button[type="submit"]', {
|
const submit = await page.waitForSelector('button[type="submit"]', {
|
||||||
timeout: timeoutMs
|
timeout: timeoutMs
|
||||||
})
|
})
|
||||||
frame.focus('button[type="submit"]')
|
await frame.focus('button[type="submit"]')
|
||||||
await submit.focus()
|
await submit.focus()
|
||||||
await submit.click()
|
await submit.click()
|
||||||
await page.waitForSelector('#password', { timeout: timeoutMs })
|
await page.waitForSelector('#password', { timeout: timeoutMs })
|
||||||
|
@ -588,12 +588,14 @@ async function waitForRecaptcha(
|
||||||
const captcha = await page.$('textarea#g-recaptcha-response')
|
const captcha = await page.$('textarea#g-recaptcha-response')
|
||||||
if (!captcha) {
|
if (!captcha) {
|
||||||
// the user may have gone past the page manually
|
// the user may have gone past the page manually
|
||||||
|
console.log('captcha no longer found; continuing')
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
const value = (await captcha.evaluate((el) => el.value))?.trim()
|
const value = (await captcha.evaluate((el) => el.value))?.trim()
|
||||||
if (value?.length) {
|
if (value?.length) {
|
||||||
// recaptcha has been solved!
|
// recaptcha has been solved!
|
||||||
|
console.log('captcha solved; continuin')
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Ładowanie…
Reference in New Issue