Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Chatgpt Puppeteer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Chatgpt Puppeteer
Commits
5c7b9d64
Commit
5c7b9d64
authored
Dec 31, 2022
by
Travis Fischer
Committed by
GitHub
Dec 31, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #219 from fuergaosi233/feat/impove-robustness
Fix undefined
parents
c29a5f3f
e98f740f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
13 deletions
+25
-13
src/openai-auth.ts
src/openai-auth.ts
+25
-13
No files found.
src/openai-auth.ts
View file @
5c7b9d64
...
...
@@ -126,14 +126,16 @@ export async function getOpenAIAuth({
await
delay
(
500
)
// click login button and wait for navigation to finish
await
Promise
.
all
([
page
.
waitForNavigation
({
waitUntil
:
'
networkidle2
'
,
timeout
:
timeoutMs
}),
page
.
click
(
'
#__next .btn-primary
'
)
])
while
(
page
.
url
().
endsWith
(
'
/auth/login
'
))
{
await
Promise
.
all
([
page
.
waitForNavigation
({
waitUntil
:
'
networkidle2
'
,
timeout
:
timeoutMs
}),
page
.
click
(
'
#__next .btn-primary
'
)
])
delay
(
500
)
}
await
checkForChatGPTAtCapacity
(
page
,
{
timeoutMs
})
...
...
@@ -179,12 +181,22 @@ export async function getOpenAIAuth({
if
(
hasNopechaExtension
)
{
await
waitForRecaptcha
(
page
,
{
timeoutMs
})
}
else
if
(
hasRecaptchaPlugin
)
{
// Add retry for network unstable
console
.
log
(
'
solving captchas using 2captcha...
'
)
const
res
=
await
page
.
solveRecaptchas
()
if
(
res
.
captchas
?.
length
)
{
console
.
log
(
'
captchas result
'
,
res
)
}
else
{
console
.
log
(
'
no captchas found
'
)
const
retries
=
3
for
(
let
i
=
0
;
i
<
retries
;
i
++
)
{
try
{
const
res
=
await
page
.
solveRecaptchas
()
if
(
res
.
captchas
?.
length
)
{
console
.
log
(
'
captchas result
'
,
res
)
break
}
else
{
console
.
log
(
'
no captchas found
'
)
delay
(
500
)
}
}
catch
(
e
)
{
console
.
log
(
'
captcha error
'
,
e
)
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment