nstbrowser-sdk-node v0.0.10
NST BROWSER NODE SDK
Nst browser node sdk
Installing
Using npm:
$ npm install nstbrowser-sdk-nodeUsing pnpm:
$ pnpm install nstbrowser-sdk-nodeUsing yarn:
$ yarn add nstbrowser-sdk-nodeHow To Use
javascript:
import { NstBrowser } from 'nstbrowser-sdk-node';
const nst = new NstBrowser('your api key', {
timeout: 60000,
apiAddress: 'http://localhost:8848/api/agent'
});
const { getLatestVersion } = nst.agentManager();
getLatestVersion();typescript:
import { NstBrowser, NstBrowserTypes } from 'nstbrowser-sdk-node';
const nst: NstBrowserTypes = new NstBrowser('your api key', {
timeout: 60000,
apiAddress: 'http://localhost:8848/api/agent'
});
const { getLatestVersion } = nst.agentManager();
getLatestVersion();Browserless:
import { Browserless } from 'nstbrowser-sdk-node';
const browserless = new Browserless({
apiKey: 'your api key',
proxy: 'your proxy', // required
})
browserless.load('https://nstbrowser.io').then(text => {
})NstBrowser Node Sdk Response Schema:
{
// `data` is the response
"data": {},
// `code` is the HTTP status code
"code": 200,
// `err` is the request's status
"err": false,
"msg": "success"
}BrowserManager
forceStart
force start the browser by profileId
const { forceStart } = nst.browserManager();
forceStart(profileId: string);start
start the browser by profileId
const { start } = nst.browserManager();
start(profileId: string);startSome
batch start browser by profileIds
const { startSome } = nst.browserManager();
startSome(profileIds: string[]);stop
stop the browser by profileId
const { stop } = nst.browserManager();
stop(profileId: string);stopSome
batch stop browser by profileIds
const { stopSome } = nst.browserManager();
stopSome(profileIds: string[]);stopAll
stop all running browser
const { stopAll } = nst.browserManager();
stopAll();getRunningBrowserAll
get all running browser's info
const { getRunningBrowserAll } = nst.browserManager();
getRunningBrowserAll();response data:
[
{
profileId: "string",
name: "string",
version: "string",
kernelType: "string", // nstchrome | nstfirefox
running: "boolean",
userDirPath: "string"
}
]getRemoteDebuggingAddress
get browser remote web socket debugging url
const { getRemoteDebuggingAddress } = nst.browserManager();
getRemoteDebuggingAddress(profileId: string);getProfilesStatus
get all profiles status
const { getProfilesStatus } = nst.browserManager();
getProfilesStatus();ProfileManager
createProfile
create profile
const { createProfile } = nst.profileManager();
createProfile({
"kernel": "chromium",
"kernelMilestone": "120",
"name": "Profile",
"platform": "windows"
});response data:
{
"_id": "string",
"createdAt": "string",
"fingerprintId": "string",
"groupId": "string",
"kernel": 0,
"kernelMilestone": "string",
"kernelVersion": "string",
"name": "string",
"note": "string",
"platform": 0,
"platformVersion": "string",
"profileId": "string",
"saveLocal": true,
"status": 0,
"tags": [
"string"
],
"teamId": "string",
"uaFullVersion": "string",
"updatedAt": "string",
"userId": "string"
}deleteProfile
delete profile by profileId
const { deleteProfile } = nst.profileManager();
deleteProfile(profileId: string);profiles
list profiles
const { profiles } = nst.profileManager();
profiles({
page: 1,
pageSize: 10,
s: '',
groupId: ''
});response data:
"data": {
"docs": [
{
"fingerprintId": "string",
"groupId": "string",
"kernel": 0,
"kernelMilestone": "string",
"kernelVersion": "string",
"name": "string",
"note": "string",
"platform": 0,
"platformVersion": "string",
"profileId": "string",
"proxyConfig": {
"checker": "string",
"host": "string",
"password": "string",
"port": "string",
"protocol": "string",
"proxySetting": "string",
"proxyType": "string",
"url": "string",
"username": "string"
},
"tags": [
"string"
],
"teamId": "string",
"uaFullVersion": "string",
"userId": "string"
}
],
"hasNextPage": true,
"hasPrevPage": true,
"limit": 0,
"nextPage": 0,
"offset": 0,
"page": 0,
"pagingCounter": 0,
"prevPage": 0,
"totalDocs": 0,
"totalPages": 0
}batchUpdateProxy
batch update proxy for profiles, if proxy url is empty,you should set value to: protocol、host and port, otherwise set proxy url just fine.
const { batchUpdateProxy } = nst.profileManager();
batchUpdateProxy({
"profileIds": ["string"],
"proxyConfig": {
"checker": "string",
"host": "string",
"password": "string",
"port": "string",
"protocol": "string",
"proxySetting": "string",
"proxyType": "string",
"url": "string",
"username": "string"
}
});getProfileTags
get all profile tags
const { getProfileTags } = nst.profileManager();
getProfileTags();response data:
[
{
color: "string",
name: "string",
}
]batchUpdateProfileTags
batch update profile tags
const { batchUpdateProfileTags } = nst.profileManager();
batchUpdateProfileTags({
"profileIds": string[],
"tags": {
"color": string;
"name": string;
}[]
});batchCreateProfileTags
batch create profile tags
const { batchCreateProfileTags } = nst.profileManager();
batchCreateProfileTags({
"profileIds": string[],
"tags": {
"color": string;
"name": string;
}[]
});batchClearProfileTags
batch clear profile tags
const { batchClearProfileTags } = nst.profileManager();
batchClearProfileTags({
"profileIds": ["string"]
});clearCookies
clear local cookies by profileId
const { clearCookies } = nst.profileManager();
clearCookies("profileId")clearProfileCache
clear user profile dir.
const { clearProfileCache } = nst.profileManager();
clearProfileCache("profileId")batchClearProfileCache
batch clear user profile dir.
const { batchClearProfileCache } = nst.profileManager();
batchClearProfileCache(["profileId"])Devtool
launchNewBrowser
launch new browser Detail docs
const { launchNewBrowser } = nst.devtool();
launchNewBrowser(config);response data:
{
"port": 0,
"webSocketDebuggerUrl": "string"
}launchExistBrowser
launch exist browser Detail docs
const { launchExistBrowser } = nst.devtool();
launchExistBrowser(profileId: string, {
config?: string,
});response data:
{
"port": 0,
"webSocketDebuggerUrl": "string"
}8 months ago
12 months ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago