Commit 97fef500 authored by nanahira's avatar nanahira

updates

parent e3a96b68
......@@ -47,7 +47,7 @@ async function fetchSSE(url2, options) {
const { onMessage, ...fetchOptions } = options;
const res = await fetch2(url2, fetchOptions);
if (!res.ok) {
const msg = `ChatGPTAPI error ${res.status || res.statusText}`;
const msg = `ChatGPTAPI error ${res.status || res.statusText} ${res.json()}`;
const error = new ChatGPTError(msg);
error.statusCode = res.status;
error.statusText = res.statusText;
......@@ -906,8 +906,8 @@ async function getOpenAIAuth({
]);
await delay(1e3);
} else {
await page.waitForSelector("#username");
await page.type("#username", email);
await page.waitForSelector("#email-input");
await page.type("#email-input", email);
await delay(100);
if (!hasRecaptchaPlugin) {
await waitForRecaptcha(page, { timeoutMs });
......@@ -931,20 +931,19 @@ async function getOpenAIAuth({
}
await delay(2e3);
const frame = page.mainFrame();
const continueSelector = ".continue-btn";
const submit = await page.waitForSelector(
'button[type="submit"][data-action-button-primary="true"]',
continueSelector,
{
timeout: timeoutMs
}
);
await frame.focus(
'button[type="submit"][data-action-button-primary="true"]'
);
await frame.focus(continueSelector);
await submit.focus();
await submit.click();
await page.waitForSelector("#password", { timeout: timeoutMs });
await page.type("#password", password);
await delay(1e4);
await delay(5e3);
submitP = async () => {
await page.click(
'button[type="submit"][data-action-button-primary="true"]'
......@@ -1651,10 +1650,8 @@ var ChatGPTAPIBrowser = class extends AChatGPTAPI {
} else if (error.statusCode !== 403) {
throw error;
} else if (numTries >= 2) {
await this.refreshSession();
throw error;
} else {
await this.refreshSession();
await delay2(1e3);
result = null;
continue;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -621,10 +621,10 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
} else if (error.statusCode !== 403) {
throw error
} else if (numTries >= 2) {
await this.refreshSession()
//await this.refreshSession()
throw error
} else {
await this.refreshSession()
//await this.refreshSession()
await delay(1000)
result = null
continue
......
......@@ -11,7 +11,7 @@ export async function fetchSSE(
const { onMessage, ...fetchOptions } = options
const res = await fetch(url, fetchOptions)
if (!res.ok) {
const msg = `ChatGPTAPI error ${res.status || res.statusText}`
const msg = `ChatGPTAPI error ${res.status || res.statusText} ${res.json()}`
const error = new types.ChatGPTError(msg)
error.statusCode = res.status
error.statusText = res.statusText
......
......@@ -176,8 +176,8 @@ export async function getOpenAIAuth({
])
await delay(1000)
} else {
await page.waitForSelector('#username')
await page.type('#username', email)
await page.waitForSelector('#email-input')
await page.type('#email-input', email)
await delay(100)
// NOTE: this is where you may encounter a CAPTCHA
......@@ -206,20 +206,17 @@ export async function getOpenAIAuth({
await delay(2000)
const frame = page.mainFrame()
const submit = await page.waitForSelector(
'button[type="submit"][data-action-button-primary="true"]',
{
timeout: timeoutMs
}
)
await frame.focus(
'button[type="submit"][data-action-button-primary="true"]'
)
// a button, with class continue-btn
const continueSelector = '.continue-btn'
const submit = await page.waitForSelector(continueSelector, {
timeout: timeoutMs
})
await frame.focus(continueSelector)
await submit.focus()
await submit.click()
await page.waitForSelector('#password', { timeout: timeoutMs })
await page.type('#password', password)
await delay(10000)
await delay(5000)
submitP = async () => {
//console.log('1st click')
await page.click(
......
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