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
0c57c404
Commit
0c57c404
authored
Oct 06, 2023
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes
parent
8a82498b
Pipeline
#23681
canceled with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
src/openai-auth.ts
src/openai-auth.ts
+17
-9
No files found.
src/openai-auth.ts
View file @
0c57c404
...
...
@@ -120,7 +120,9 @@ export async function getOpenAIAuth({
// login as well (optional)
if
(
email
&&
password
)
{
await
waitForConditionOrAtCapacity
(
page
,
()
=>
page
.
waitForSelector
(
'
#__next .btn-primary
'
,
{
timeout
:
timeoutMs
})
page
.
waitForSelector
(
'
#__next button:first-child
'
,
{
timeout
:
timeoutMs
})
)
await
delay
(
500
)
...
...
@@ -131,7 +133,7 @@ export async function getOpenAIAuth({
waitUntil
:
'
networkidle2
'
,
timeout
:
timeoutMs
}),
page
.
click
(
'
#__next
.btn-primary
'
)
page
.
click
(
'
#__next
button:first-child
'
)
])
await
delay
(
500
)
}
while
(
page
.
url
().
endsWith
(
'
/auth/login
'
))
...
...
@@ -153,7 +155,7 @@ export async function getOpenAIAuth({
])
await
page
.
waitForSelector
(
'
input[type="password"]
'
,
{
visible
:
true
})
await
page
.
type
(
'
input[type="password"]
'
,
password
)
await
delay
(
5
0
)
await
delay
(
20
0
)
submitP
=
()
=>
page
.
keyboard
.
press
(
'
Enter
'
)
}
else
if
(
isMicrosoftLogin
)
{
await
page
.
click
(
'
button[data-provider="windowslive"]
'
)
...
...
@@ -166,7 +168,7 @@ export async function getOpenAIAuth({
await
delay
(
1500
)
await
page
.
waitForSelector
(
'
input[type="password"]
'
,
{
visible
:
true
})
await
page
.
type
(
'
input[type="password"]
'
,
password
)
await
delay
(
5
0
)
await
delay
(
20
0
)
submitP
=
()
=>
page
.
keyboard
.
press
(
'
Enter
'
)
await
Promise
.
all
([
page
.
waitForNavigation
(),
...
...
@@ -204,16 +206,22 @@ export async function getOpenAIAuth({
await
delay
(
2000
)
const
frame
=
page
.
mainFrame
()
const
submit
=
await
page
.
waitForSelector
(
'
button[type="submit"]
'
,
{
const
submit
=
await
page
.
waitForSelector
(
'
button[type="submit"][data-action-button-primary="true"]
'
,
{
timeout
:
timeoutMs
})
await
frame
.
focus
(
'
button[type="submit"]
'
)
}
)
await
frame
.
focus
(
'
button[type="submit"][data-action-button-primary="true"]
'
)
await
submit
.
focus
()
await
submit
.
click
()
await
page
.
waitForSelector
(
'
#password
'
,
{
timeout
:
timeoutMs
})
await
page
.
type
(
'
#password
'
,
password
)
await
delay
(
200
)
submitP
=
()
=>
page
.
click
(
'
button[type="submit"]
'
)
submitP
=
()
=>
page
.
click
(
'
button[type="submit"][data-action-button-primary="true"]
'
)
}
await
Promise
.
all
([
...
...
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