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
205d6d97
Commit
205d6d97
authored
Dec 16, 2022
by
Travis Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: change browserPath=>executablePath
parent
cd063b59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
10 deletions
+25
-10
src/chatgpt-api-browser.ts
src/chatgpt-api-browser.ts
+25
-10
No files found.
src/chatgpt-api-browser.ts
View file @
205d6d97
...
@@ -22,7 +22,7 @@ export class ChatGPTAPIBrowser {
...
@@ -22,7 +22,7 @@ export class ChatGPTAPIBrowser {
protected
_email
:
string
protected
_email
:
string
protected
_password
:
string
protected
_password
:
string
protected
_
browser
Path
:
string
protected
_
executable
Path
:
string
protected
_browser
:
Browser
protected
_browser
:
Browser
protected
_page
:
Page
protected
_page
:
Page
...
@@ -49,7 +49,7 @@ export class ChatGPTAPIBrowser {
...
@@ -49,7 +49,7 @@ export class ChatGPTAPIBrowser {
captchaToken
?:
string
captchaToken
?:
string
/** @defaultValue `undefined` **/
/** @defaultValue `undefined` **/
browser
Path
?:
string
executable
Path
?:
string
})
{
})
{
const
{
const
{
email
,
email
,
...
@@ -59,7 +59,7 @@ export class ChatGPTAPIBrowser {
...
@@ -59,7 +59,7 @@ export class ChatGPTAPIBrowser {
isGoogleLogin
=
false
,
isGoogleLogin
=
false
,
minimize
=
true
,
minimize
=
true
,
captchaToken
,
captchaToken
,
browser
Path
executable
Path
}
=
opts
}
=
opts
this
.
_email
=
email
this
.
_email
=
email
...
@@ -70,7 +70,7 @@ export class ChatGPTAPIBrowser {
...
@@ -70,7 +70,7 @@ export class ChatGPTAPIBrowser {
this
.
_isGoogleLogin
=
!!
isGoogleLogin
this
.
_isGoogleLogin
=
!!
isGoogleLogin
this
.
_minimize
=
!!
minimize
this
.
_minimize
=
!!
minimize
this
.
_captchaToken
=
captchaToken
this
.
_captchaToken
=
captchaToken
this
.
_
browserPath
=
browser
Path
this
.
_
executablePath
=
executable
Path
}
}
async
init
()
{
async
init
()
{
...
@@ -78,21 +78,22 @@ export class ChatGPTAPIBrowser {
...
@@ -78,21 +78,22 @@ export class ChatGPTAPIBrowser {
await
this
.
_browser
.
close
()
await
this
.
_browser
.
close
()
this
.
_page
=
null
this
.
_page
=
null
this
.
_browser
=
null
this
.
_browser
=
null
this
.
_accessToken
=
null
}
}
try
{
try
{
this
.
_browser
=
await
getBrowser
({
this
.
_browser
=
await
getBrowser
({
captchaToken
:
this
.
_captchaToken
,
captchaToken
:
this
.
_captchaToken
,
executablePath
:
this
.
_
browser
Path
executablePath
:
this
.
_
executable
Path
})
})
this
.
_page
=
this
.
_page
=
(
await
this
.
_browser
.
pages
())[
0
]
||
(
await
this
.
_browser
.
newPage
())
(
await
this
.
_browser
.
pages
())[
0
]
||
(
await
this
.
_browser
.
newPage
())
await
maximizePage
(
this
.
_page
)
this
.
_page
.
on
(
'
request
'
,
this
.
_onRequest
.
bind
(
this
))
this
.
_page
.
on
(
'
request
'
,
this
.
_onRequest
.
bind
(
this
))
this
.
_page
.
on
(
'
response
'
,
this
.
_onResponse
.
bind
(
this
))
this
.
_page
.
on
(
'
response
'
,
this
.
_onResponse
.
bind
(
this
))
maximizePage
(
this
.
_page
)
// bypass cloudflare and login
// bypass cloudflare and login
await
getOpenAIAuth
({
await
getOpenAIAuth
({
email
:
this
.
_email
,
email
:
this
.
_email
,
...
@@ -344,9 +345,23 @@ export class ChatGPTAPIBrowser {
...
@@ -344,9 +345,23 @@ export class ChatGPTAPIBrowser {
const
inputBox
=
await
this
.
_getInputBox
()
const
inputBox
=
await
this
.
_getInputBox
()
if
(
!
inputBox
||
!
this
.
_accessToken
)
{
if
(
!
inputBox
||
!
this
.
_accessToken
)
{
const
error
=
new
types
.
ChatGPTError
(
'
Not signed in
'
)
console
.
log
(
`chatgpt re-authenticating
${
this
.
_email
}
`
)
error
.
statusCode
=
401
let
isAuthenticated
=
false
throw
error
try
{
isAuthenticated
=
await
this
.
init
()
}
catch
(
err
)
{
console
.
warn
(
`chatgpt error re-authenticating
${
this
.
_email
}
`
,
err
.
toString
()
)
}
if
(
!
isAuthenticated
||
!
this
.
_accessToken
)
{
const
error
=
new
types
.
ChatGPTError
(
'
Not signed in
'
)
error
.
statusCode
=
401
throw
error
}
}
}
const
url
=
`https://chat.openai.com/backend-api/conversation`
const
url
=
`https://chat.openai.com/backend-api/conversation`
...
...
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