justbrowse.io
A nodejs package to interact with the justbrowse.io
Installation
npm i justbrowse.io
pnpm add justbrowse.io
yarn add justbrowse.io
Usage
ChatGPT
We create our client:
import { ChatGPT } from "justbrowse.io";
const sessionToken = "Read Bellow how to get your chatgpt session token";
const apiToken = "Go to https://justbrowse.io to get your api token"; // API token is now optional
(async () => {
var client = new ChatGPT(sessionToken);
// var client = new Client(sessionToken, apiToken);
await client.init();
// check status:
var status = await client.status();
if (status == "ready") {
// Send a message:
var response = await client.chat("message");
console.log(response);
// Create a new conversation:
var conversation = await client.createConversation();
// send a message to the conversation:
var res = await conversation.sendMessage("message", message);
console.log(res);
}
})();
Get your session token:
- Go to https://chat.openai.com/chat
- Log in to your account
- Open developer tools
- Go to the application section
- Go to the cookies section
- And get your session token which is the cookie with the name: "__Secure-next-auth.session-token"
Crawler
import { Crawl } from "justbrowse.io";
(async () => {
// Crawl html
var { requestId, html } = await Crawl(
"html",
"https://google.com?q=news+for+today"
);
console.log(requestId, html);
// Crawl text
var { requestId, text } = await Crawl(
"text",
"https://google.com?q=news+for+today"
);
console.log(requestId, text);
})();