1.1.2 • Published 4 months ago

chatgpt-web.js v1.1.2

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

what is chatgpt-web.js ?

it's a nodejs web scraping library for chatgpt.com website.

this library give you free programmable access to chatgpt.com for automate your tasks.

here, you can name your assistant, write a roles, and so on.

installation

run npm install chatgpt-web.js for installing the library

example

const chatgpt = new ChatGPT({
	assistantName:  "Abbas",
	puppeteer: {
		userDataDir: join(process.cwd(), ".webdata"),
		headless: false,
	},
});

// will be ready if the user logged in
chatgpt.on("ready", async () => {
	await chatgpt.selectTemporaryChat();
	await chatgpt.hide(); // set headless to true for hide the browser window
	const response = await chatgpt.generate("hello, who are you and what you want ?");
	console.log(response);
});

// will initialize the scraper and open the browser window
// you can hide or show the browser window anytime using 'chatgpt.hide()' and 'chatgpt.show()'
chatgpt.initialize();

events

ready => emitted when the user authenticated.

disconnected => emitted when user logout.

login_page => emitted when the login page opened or occured.

browser_destroyed => emitted when chatgpt.destroy() called.

hide => emitted when call chatgpt.hide() for hiding the browser.

show => emitted when call chatgpt.show() for show the browser.

initialized => emitted when the chatgpt scrapper initialized.

options_changed => emitted when change the options using chatgpt.setOptions(...) only.

location_change => emitted on any navigation on the page.

methods

on => will register an event listener.

emit => will emit an event.

initalize => will initialize the chatgpt scrapper.

getInitializedData => will return object contains page and browser of puppeteer.

waitForLoad => will return a promise that's will be full filled. when the input textarea load.

getCookies => returns all puppeteer browser cookies.

getAuthorizationString => returns a string line 'Bearer xyz...' for authenticate the requests.

deleteChat => taking chatId and deleting it.

getChats => taking offset and limit for get chats data chunk.

getChat => taking chatId and returning ChatGPTChat type or null

clickOnSearchIcon => will click on search icon button for toggle search state.

selectTemporaryChat => will navigate the page to temporary chat page.

selectNewChat => will naviate to new chat page.

selectChat => taking chatId and navigate to it's page.

getSelectedChat => return the type and the id of the current selected conversation or chat.

generate => will take a message and options, and return chatgpt response.

destroy => destroy the scrapper and close the controlled browser.

setOptions => override the scrapper instance options.

show => show the controlled browser.

hide => will hide the controlled browser.

1.1.2

4 months ago

1.1.1

5 months ago

1.1.0

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago