This package provides functionality to run and stop GoLogin profiles with node.js and then connect the profiles to automation tools like Selenium, Puppetteer, Playwright etc.
- You give SDK your dev token and profile id that you want to run
- SDK takes care of downloading, preparing your profile and starts the browser
- SDK gives you websocket url for automation tools
- You take this websocker url and connect it to the automation tool on your choice: Puppetteer, Selenium, Playwright etc
- Automation tool connects to browser and you can manage it through code
Where is token? API token is here.
npm i gologin
import { GologinApi } from './src/gologin-api.js';
const GL = GologinApi({
token: 'your token',
});
const profile = await GL.createProfileRandomFingerprint('some name');
const profileId = profile.id;
await GL.addGologinProxyToProfile(profileId, 'us');
const browser = await GL.launch({ profileId });
const page = await browser.newPage();
await page.goto('https://linkedin.com');
await new Promise((resolve) => setTimeout(resolve, 5000));
await browser.close();
await GL.stop();
Required options:
token
<[string]> Required - your API token
Optional options:
profile_id
<[string]> - profile ID (NOT PROFILE NAME) will be generated if not specifiedexecutablePath
<[string]> path to executable Orbita file. Orbita will be downloaded automatically if not specifiedextra_params
arrayof <[string]> additional flags for browser start. For example: '--headles', '--load-extentions=path/to/extension'uploadCookiesToServer
<[boolean]> upload cookies to server after profile stopping (default false). It allows you to export cookies from api later.writeCookesFromServer
<[boolean]> if you have predefined cookies and you want browser to import it (default true).tmpdir
<[string]> absolute path to the directtory where you want to store user-data-dir. Default path in tmp folder will be picked if no specifiedvncPort
<[integer]> port of VNC server if you using it
const GL = new GoLogin({
token: 'your token',
profile_id: 'profile id',
extra_params: ["--headless", "--load-extentions=path/to/extension"]
});
createProfileRandomFingerprint - you pass os ('lin', 'win', 'mac') and profile name and we give you brand new shiny profile
const GL = new GoLogin({
token: 'your token',
profile_id: 'profile id',
extra_params: ["--headless", "--load-extentions=path/to/extension"]
});
const profile = await gl.createProfileRandomFingerprint("some name")
const profileId = profile.id
createProfileWithCustomParams - This method creates a profile and you can pass any particular params to it. Full list of params you can find here - https://api.gologin.com/docs
const GL = GoLogin({
"token": "your token",
})
const profile = await gl.createProfileWithCustomParams({
"os": "lin",
"name": "some name",
"navigator": {
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
"resolution": "1920x1080",
"language": "en-US",
"platform": "Linux x86_64",
"hardwareConcurrency": 8,
"deviceMemory": 8,
"maxTouchPoints": 0
}
})
const profileId = profile.id
updateUserAgentToLatestBrowser - user agent is one of the most important thing in your fingerprint. It decides which browser version to run. This method help you to keep useragent up to date.
const GL = GoLogin({
"token": "your token",
})
await GL.updateUserAgentToLatestBrowser(["profineId1", "profileId2"], "workspceId(optional)")
addGologinProxyToProfile - Gologin provides high quality proxies with free traffic for paid users. Here you can add gologin proxy to profile, just pass country code
const GL = GoLogin({
"token": "your token",
})
await GL.addGologinProxyToProfile("profileId", "us")
addCookiesToProfile - You can pass cookies to the profile and browser will import it before starting
const GL = GoLogin({
"token": "your token",
})
await GL.addCookiesToProfile("profileId", [
{
"name": "session_id",
"value": "abc123",
"domain": "example.com",
"path": "/",
"expirationDate": 1719161018.307793,
"httpOnly": True,
"secure": True
},
{
"name": "user_preferences",
"value": "dark_mode",
"domain": "example.com",
"path": "/settings",
"sameSite": "lax"
}
])
const GL = GoLogin({
"token": "your token",
})
await GL.refreshProfilesFingerprint(["profileId1", "profileId2"])
const GL = GoLogin({
"token": "your token",
})
await GL.changeProfileProxy("profileId", { "mode": "http", "host": "somehost.com", "port": 109, "username": "someusername", "password": "somepassword"})
const GL = GoLogin({
"token": "your token",
})
await GL.launch({ profileId: 'some profileId' })
const GL = GoLogin({
"token": "your token",
})
await GL.launch({ profileId: 'some profileId' })
await GL.exit()
For debugging use DEBUG=* node example.js
command
To use GoLogin with Selenium see selenium/example.js
Swagger: link here
Postman: link here
- returns: string
start browser with profile id, return WebSocket url for puppeteer. Extracted profile folder should be in specified temp directory.
stop current browser without removing archived profile
import puppeteer from 'puppeteer-core';
import GoLogin from '../src/gologin.js';
const { connect } = puppeteer;
(async () => {
const GL = new GoLogin({
token: 'yU0token',
profile_id: 'yU0Pr0f1leiD',
executablePath: '/usr/bin/orbita-browser/chrome',
tmpdir: '/my/tmp/dir',
});
const wsUrl = await GL.startLocal();
const browser = await connect({
browserWSEndpoint: wsUrl.toString(),
ignoreHTTPSErrors: true,
});
const page = await browser.newPage();
await page.goto('https://myip.link');
console.log(await page.content());
await browser.close();
await GL.stopLocal({ posting: false });
})();
pyppeteer (recommend) and Selenium supported (see file gologin.py)
for Selenium may need download webdriver