kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
revision of last changes
rodzic
adcb7af56d
commit
ca7dbddca1
|
@ -48,7 +48,6 @@ Creates a new client for automating the ChatGPT webapp.
|
|||
| `opts.email` | `string` | - |
|
||||
| `opts.executablePath?` | `string` | **`Default Value`** `undefined` * |
|
||||
| `opts.isGoogleLogin?` | `boolean` | **`Default Value`** `false` * |
|
||||
| `opts.isWindowsLogin?` | `boolean` | **`Default Value`** `false` * |
|
||||
| `opts.markdown?` | `boolean` | **`Default Value`** `true` * |
|
||||
| `opts.minimize?` | `boolean` | **`Default Value`** `true` * |
|
||||
| `opts.password` | `string` | - |
|
||||
|
|
|
@ -262,14 +262,13 @@ Basic Cloudflare CAPTCHAs are handled by default, but if you want to automate th
|
|||
- More well-known solution that's been around longer
|
||||
- Set the `CAPTCHA_TOKEN` env var to your 2captcha API token
|
||||
|
||||
Alternatively, if your OpenAI account uses Google Auth and Microsoft, you shouldn't encounter any of the more complicated Recaptchas — and can avoid using these third-party providers. To use Google auth, make sure your OpenAI account is using Google or Microsoft and then set either `isGoogleLogin` or `isWindowsLogin` to `true` whenever you're passing your `email` and `password`. For example:
|
||||
Alternatively, if your OpenAI account uses Google Auth, you shouldn't encounter any of the more complicated Recaptchas — and can avoid using these third-party providers. To use Google auth, make sure your OpenAI account is using Google and then set `isGoogleLogin` to `true` whenever you're passing your `email` and `password`. For example:
|
||||
|
||||
```ts
|
||||
const api = new ChatGPTAPIBrowser({
|
||||
email: process.env.OPENAI_EMAIL,
|
||||
password: process.env.OPENAI_PASSWORD,
|
||||
isGoogleLogin: true
|
||||
isWindowsLogin: true // use only one of this options.
|
||||
})
|
||||
```
|
||||
|
||||
|
|
|
@ -254,14 +254,13 @@ Basic Cloudflare CAPTCHAs are handled by default, but if you want to automate th
|
|||
- More well-known solution that's been around longer
|
||||
- Set the `CAPTCHA_TOKEN` env var to your 2captcha API token
|
||||
|
||||
Alternatively, if your OpenAI account uses Google Auth and Microsoft, you shouldn't encounter any of the more complicated Recaptchas — and can avoid using these third-party providers. To use Google auth, make sure your OpenAI account is using Google or Microsoft and then set either `isGoogleLogin` or `isWindowsLogin` to `true` whenever you're passing your `email` and `password`. For example:
|
||||
Alternatively, if your OpenAI account uses Google Auth, you shouldn't encounter any of the more complicated Recaptchas — and can avoid using these third-party providers. To use Google auth, make sure your OpenAI account is using Google and then set `isGoogleLogin` to `true` whenever you're passing your `email` and `password`. For example:
|
||||
|
||||
```ts
|
||||
const api = new ChatGPTAPIBrowser({
|
||||
email: process.env.OPENAI_EMAIL,
|
||||
password: process.env.OPENAI_PASSWORD,
|
||||
isGoogleLogin: true
|
||||
isWindowsLogin: true // use only one of this options.
|
||||
})
|
||||
```
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
|
|||
protected _debug: boolean
|
||||
protected _minimize: boolean
|
||||
protected _isGoogleLogin: boolean
|
||||
protected _isWindowsLogin: boolean
|
||||
protected _isMicrosoftLogin: boolean
|
||||
protected _captchaToken: string
|
||||
protected _accessToken: string
|
||||
|
||||
|
@ -48,7 +48,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
|
|||
isGoogleLogin?: boolean
|
||||
|
||||
/** @defaultValue `false` **/
|
||||
isWindowsLogin?: boolean
|
||||
isMicrosoftLogin?: boolean
|
||||
|
||||
/** @defaultValue `true` **/
|
||||
minimize?: boolean
|
||||
|
@ -67,7 +67,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
|
|||
markdown = true,
|
||||
debug = false,
|
||||
isGoogleLogin = false,
|
||||
isWindowsLogin = false,
|
||||
isMicrosoftLogin = false,
|
||||
minimize = true,
|
||||
captchaToken,
|
||||
executablePath
|
||||
|
@ -79,7 +79,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
|
|||
this._markdown = !!markdown
|
||||
this._debug = !!debug
|
||||
this._isGoogleLogin = !!isGoogleLogin
|
||||
this._isWindowsLogin = !!isWindowsLogin
|
||||
this._isMicrosoftLogin = !!isMicrosoftLogin
|
||||
this._minimize = !!minimize
|
||||
this._captchaToken = captchaToken
|
||||
this._executablePath = executablePath
|
||||
|
@ -131,7 +131,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
|
|||
browser: this._browser,
|
||||
page: this._page,
|
||||
isGoogleLogin: this._isGoogleLogin,
|
||||
isWindowsLogin: this._isWindowsLogin
|
||||
isMicrosoftLogin: this._isMicrosoftLogin
|
||||
})
|
||||
} catch (err) {
|
||||
if (this._browser) {
|
||||
|
@ -144,7 +144,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
|
|||
throw err
|
||||
}
|
||||
|
||||
if (!this.isChatPage || this._isGoogleLogin || this._isWindowsLogin) {
|
||||
if (!this.isChatPage || this._isGoogleLogin || this._isMicrosoftLogin) {
|
||||
await this._page.goto(CHAT_PAGE_URL, {
|
||||
waitUntil: 'networkidle2'
|
||||
})
|
||||
|
|
|
@ -53,7 +53,7 @@ export async function getOpenAIAuth({
|
|||
page,
|
||||
timeoutMs = 2 * 60 * 1000,
|
||||
isGoogleLogin = false,
|
||||
isWindowsLogin = false,
|
||||
isMicrosoftLogin = false,
|
||||
captchaToken = process.env.CAPTCHA_TOKEN,
|
||||
nopechaKey = process.env.NOPECHA_KEY,
|
||||
executablePath
|
||||
|
@ -64,7 +64,7 @@ export async function getOpenAIAuth({
|
|||
page?: Page
|
||||
timeoutMs?: number
|
||||
isGoogleLogin?: boolean
|
||||
isWindowsLogin?: boolean
|
||||
isMicrosoftLogin?: boolean
|
||||
captchaToken?: string
|
||||
nopechaKey?: string
|
||||
executablePath?: string
|
||||
|
@ -134,7 +134,7 @@ export async function getOpenAIAuth({
|
|||
await page.waitForSelector('input[type="password"]', { visible: true })
|
||||
await page.type('input[type="password"]', password, { delay: 10 })
|
||||
submitP = () => page.keyboard.press('Enter')
|
||||
} else if (isWindowsLogin) {
|
||||
} else if (isMicrosoftLogin) {
|
||||
await page.click('button[data-provider="windowslive"]')
|
||||
await page.waitForSelector('input[type="email"]')
|
||||
await page.type('input[type="email"]', email, { delay: 10 })
|
||||
|
@ -146,10 +146,10 @@ export async function getOpenAIAuth({
|
|||
await page.waitForSelector('input[type="password"]', { visible: true })
|
||||
await page.type('input[type="password"]', password, { delay: 10 })
|
||||
submitP = () => page.keyboard.press('Enter')
|
||||
await Promise.all([
|
||||
page.waitForNavigation(),
|
||||
await page.keyboard.press('Enter')
|
||||
])
|
||||
// await Promise.all([
|
||||
// page.waitForNavigation(),
|
||||
// await page.keyboard.press('Enter')
|
||||
// ])
|
||||
await delay(1000)
|
||||
} else {
|
||||
await page.waitForSelector('#username')
|
||||
|
|
Ładowanie…
Reference in New Issue