gologin 2.1.20 → 2.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/DEVREADME.md +0 -0
- package/examples/puppeter/cloud-browser.js +30 -0
- package/examples/puppeter/headless.js +30 -0
- package/examples/puppeter/local-browser.js +29 -0
- package/examples/puppeter/one-time-use-profile.js +31 -0
- package/package.json +2 -2
- package/src/gologin-api.js +14 -0
- package/example.js +0 -36
- package/examples/example-amazon-cloud-browser.js +0 -37
- package/examples/example-amazon-headless.js +0 -50
- package/examples/example-amazon.js +0 -47
- package/examples/example-cloud.js +0 -17
- package/examples/example-create-custom-profile.js +0 -39
- package/examples/example-create-profile.js +0 -40
- package/examples/example-custom-args.js +0 -34
- package/examples/example-fast-profile-settings.js +0 -69
- package/examples/example-gmail.js +0 -67
- package/examples/example-iphey.js +0 -17
- package/examples/example-local-profile.js +0 -26
- package/examples/example-login-walmart.js +0 -35
- package/examples/example-stopremote.js +0 -20
- package/examples/example-timezone.js +0 -44
package/CHANGELOG.md
ADDED
package/DEVREADME.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Gologin provides a cloud browser that can be used to run puppeteer aytomation.
|
|
2
|
+
// It will handle the browser start and close management - you just need to control the browser with pupputter
|
|
3
|
+
import { GologinApi } from 'gologin';
|
|
4
|
+
|
|
5
|
+
const token = process.env.GL_API_TOKEN || 'your dev token here';
|
|
6
|
+
const gologin = GologinApi({
|
|
7
|
+
token,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
async function main() {
|
|
11
|
+
const { browser } = await gologin.launch({
|
|
12
|
+
cloud: true,
|
|
13
|
+
// pass profileId parameter if you want to run particular profile
|
|
14
|
+
// profileId: 'your profileId here',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const page = await browser.newPage();
|
|
18
|
+
|
|
19
|
+
await page.goto('https://iphey.com/', { waitUntil: 'networkidle2' });
|
|
20
|
+
const status = await page.$eval('.trustworthy:not(.hide)',
|
|
21
|
+
(elt) => elt?.innerText?.trim(),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
console.log('status', status);
|
|
25
|
+
|
|
26
|
+
return status;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
main().catch(console.error)
|
|
30
|
+
.finally(gologin.exit);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// SDK will prepare the browser and will start it on your machine then you can control it with puppeteer
|
|
2
|
+
import { GologinApi } from 'gologin';
|
|
3
|
+
|
|
4
|
+
const token = process.env.GL_API_TOKEN || 'your dev token here';
|
|
5
|
+
const gologin = GologinApi({
|
|
6
|
+
token,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
const { browser } = await gologin.launch({
|
|
11
|
+
extra_params: ['--headless'],
|
|
12
|
+
// pass profileId parameter if you want to run particular profile
|
|
13
|
+
// profileId: 'your profileId here',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const page = await browser.newPage();
|
|
17
|
+
|
|
18
|
+
await page.goto('https://iphey.com/', { waitUntil: 'networkidle2' });
|
|
19
|
+
const status = await page.$eval('.trustworthy:not(.hide)',
|
|
20
|
+
(elt) => elt?.innerText?.trim(),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
await new Promise((resolve) => setTimeout(resolve, 10000));
|
|
24
|
+
console.log('status', status);
|
|
25
|
+
|
|
26
|
+
return status;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
main().catch(console.error)
|
|
30
|
+
.finally(gologin.exit);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// SDK will prepare the browser and will start it on your machine then you can control it with puppeteer
|
|
2
|
+
import { GologinApi } from 'gologin';
|
|
3
|
+
|
|
4
|
+
const token = process.env.GL_API_TOKEN || 'your dev token here';
|
|
5
|
+
const gologin = GologinApi({
|
|
6
|
+
token,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
const { browser } = await gologin.launch({
|
|
11
|
+
// pass profileId parameter if you want to run particular profile
|
|
12
|
+
// profileId: 'your profileId here',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const page = await browser.newPage();
|
|
16
|
+
|
|
17
|
+
await page.goto('https://iphey.com/', { waitUntil: 'networkidle2' });
|
|
18
|
+
const status = await page.$eval('.trustworthy:not(.hide)',
|
|
19
|
+
(elt) => elt?.innerText?.trim(),
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
await new Promise((resolve) => setTimeout(resolve, 10000));
|
|
23
|
+
console.log('status', status);
|
|
24
|
+
|
|
25
|
+
return status;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
main().catch(console.error)
|
|
29
|
+
.finally(gologin.exit);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// You need to create profile add proxy, use it with puppetter and then delete it
|
|
2
|
+
import { GologinApi } from '../../src/gologin-api.js';
|
|
3
|
+
|
|
4
|
+
const token = process.env.GL_API_TOKEN || 'your dev token here';
|
|
5
|
+
const gologin = GologinApi({
|
|
6
|
+
token,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
const profile = await gologin.createProfileRandomFingerprint();
|
|
11
|
+
const profileId = profile.id;
|
|
12
|
+
await gologin.addGologinProxyToProfile(profileId, 'US');
|
|
13
|
+
|
|
14
|
+
const { browser } = await gologin.launch({ profileId });
|
|
15
|
+
const page = await browser.newPage();
|
|
16
|
+
|
|
17
|
+
await page.goto('https://iphey.com/', { waitUntil: 'networkidle2' });
|
|
18
|
+
const status = await page.$eval('.trustworthy:not(.hide)',
|
|
19
|
+
(elt) => elt?.innerText?.trim(),
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
await new Promise((resolve) => setTimeout(resolve, 10000));
|
|
23
|
+
console.log('status', status);
|
|
24
|
+
|
|
25
|
+
await gologin.deleteProfile(profileId);
|
|
26
|
+
|
|
27
|
+
return status;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
main().catch(console.error)
|
|
31
|
+
.finally(gologin.exit);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gologin",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.21",
|
|
4
4
|
"description": "A high-level API to control Orbita browser over GoLogin API",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"main": "./src/gologin.js",
|
|
@@ -46,4 +46,4 @@
|
|
|
46
46
|
"format": "npx prettier --single-quote src/* --write",
|
|
47
47
|
"iphey": "GOLOGIN_PROFILE_ID= GOLOGIN_API_TOKEN= node examples/example-iphey "
|
|
48
48
|
}
|
|
49
|
-
}
|
|
49
|
+
}
|
package/src/gologin-api.js
CHANGED
|
@@ -14,6 +14,7 @@ export const getDefaultParams = () => ({
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
const createGologinProfileManager = ({ profileId, ...params }) => {
|
|
17
|
+
console.log({ params });
|
|
17
18
|
const defaults = getDefaultParams();
|
|
18
19
|
const mergedParams = {
|
|
19
20
|
...defaults,
|
|
@@ -87,6 +88,7 @@ export const GologinApi = ({ token }) => {
|
|
|
87
88
|
|
|
88
89
|
const api = {
|
|
89
90
|
async launch(params = {}) {
|
|
91
|
+
console.log();
|
|
90
92
|
if (params.cloud) {
|
|
91
93
|
return launchCloudProfile(params);
|
|
92
94
|
}
|
|
@@ -282,6 +284,18 @@ export const GologinApi = ({ token }) => {
|
|
|
282
284
|
return response.status;
|
|
283
285
|
},
|
|
284
286
|
|
|
287
|
+
async deleteProfile(profileId) {
|
|
288
|
+
const response = await fetch(`${API_URL}/browser/${profileId}`, {
|
|
289
|
+
method: 'DELETE',
|
|
290
|
+
headers: {
|
|
291
|
+
Authorization: `Bearer ${token}`,
|
|
292
|
+
'user-agent': 'gologin-api',
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
return response.status;
|
|
297
|
+
},
|
|
298
|
+
|
|
285
299
|
async exit() {
|
|
286
300
|
Promise.allSettled(browsers.map((browser) => browser.close()));
|
|
287
301
|
Promise.allSettled(
|
package/example.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import puppeteer from 'puppeteer-core';
|
|
2
|
-
|
|
3
|
-
import GoLogin from './src/gologin.js';
|
|
4
|
-
|
|
5
|
-
const token = 'yU0token';
|
|
6
|
-
const profile_id = 'yU0Pr0f1leiD';
|
|
7
|
-
|
|
8
|
-
(async () => {
|
|
9
|
-
const GL = new GoLogin({
|
|
10
|
-
token,
|
|
11
|
-
profile_id,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const { status, wsUrl } = await GL.start().catch((e) => {
|
|
15
|
-
console.trace(e);
|
|
16
|
-
|
|
17
|
-
return { status: 'failure' };
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
if (status !== 'success') {
|
|
21
|
-
console.log('Invalid status');
|
|
22
|
-
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const browser = await puppeteer.connect({
|
|
27
|
-
browserWSEndpoint: wsUrl.toString(),
|
|
28
|
-
ignoreHTTPSErrors: true,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const page = await browser.newPage();
|
|
32
|
-
await page.goto('https://myip.link/mini');
|
|
33
|
-
console.log(await page.content());
|
|
34
|
-
await browser.close();
|
|
35
|
-
await GL.stop();
|
|
36
|
-
})();
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// Usage example: in the terminal enter
|
|
2
|
-
// node example-amazon-cloud-browser.js yU0token yU0Pr0f1leiD
|
|
3
|
-
|
|
4
|
-
// your token api (located in the settings, api)
|
|
5
|
-
// https://github.com/gologinapp/gologin#usage
|
|
6
|
-
|
|
7
|
-
import GoLogin from 'gologin';
|
|
8
|
-
import puppeteer from 'puppeteer-core';
|
|
9
|
-
|
|
10
|
-
const [_execPath, _filePath, GOLOGIN_API_TOKEN, GOLOGIN_PROFILE_ID] = process.argv;
|
|
11
|
-
|
|
12
|
-
(async () => {
|
|
13
|
-
const GL = new GoLogin({
|
|
14
|
-
token: GOLOGIN_API_TOKEN,
|
|
15
|
-
profile_id: GOLOGIN_PROFILE_ID,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const browser = await puppeteer.connect({
|
|
19
|
-
browserWSEndpoint: `https://cloudbrowser.gologin.com/connect?token=${GOLOGIN_API_TOKEN}&profile=${GOLOGIN_PROFILE_ID}`,
|
|
20
|
-
ignoreHTTPSErrors: true,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const page = await browser.newPage();
|
|
24
|
-
|
|
25
|
-
await page.goto('https://www.amazon.com/-/dp/B0771V1JZX');
|
|
26
|
-
const content = await page.content();
|
|
27
|
-
const matchData = content.match(/'initial': (.*)}/);
|
|
28
|
-
if (matchData === null || matchData.length === 0){
|
|
29
|
-
console.log('no images found');
|
|
30
|
-
} else {
|
|
31
|
-
const data = JSON.parse(matchData[1]);
|
|
32
|
-
const images = data.map(e => e.hiRes);
|
|
33
|
-
console.log('images=', images);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
await GL.stopRemote();
|
|
37
|
-
})();
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// Usage example: in the terminal enter
|
|
2
|
-
// node example-amazon-headless.js yU0token yU0Pr0f1leiD
|
|
3
|
-
|
|
4
|
-
// your token api (located in the settings, api)
|
|
5
|
-
// https://github.com/gologinapp/gologin#usage
|
|
6
|
-
|
|
7
|
-
import GoLogin from 'gologin';
|
|
8
|
-
import puppeteer from 'puppeteer-core';
|
|
9
|
-
|
|
10
|
-
const [_execPath, _filePath, GOLOGIN_API_TOKEN, GOLOGIN_PROFILE_ID] = process.argv;
|
|
11
|
-
|
|
12
|
-
const delay = (time) => new Promise((resolve) => setTimeout(resolve, time));
|
|
13
|
-
|
|
14
|
-
(async () => {
|
|
15
|
-
const GL = new GoLogin({
|
|
16
|
-
token: GOLOGIN_API_TOKEN,
|
|
17
|
-
profile_id: GOLOGIN_PROFILE_ID,
|
|
18
|
-
extra_params: ['--headless', '--no-sandbox'],
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const { _status, wsUrl } = await GL.start();
|
|
22
|
-
const browser = await puppeteer.connect({
|
|
23
|
-
browserWSEndpoint: wsUrl.toString(),
|
|
24
|
-
ignoreHTTPSErrors: true,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const page = await browser.newPage();
|
|
28
|
-
await delay(300);
|
|
29
|
-
|
|
30
|
-
const viewPort = GL.getViewPort();
|
|
31
|
-
await page.setViewport({ width: Math.round(viewPort.width * 0.994), height: Math.round(viewPort.height * 0.92) });
|
|
32
|
-
const session = await page.target().createCDPSession();
|
|
33
|
-
const { windowId } = await session.send('Browser.getWindowForTarget');
|
|
34
|
-
await session.send('Browser.setWindowBounds', { windowId, bounds: viewPort });
|
|
35
|
-
await session.detach();
|
|
36
|
-
|
|
37
|
-
await page.goto('https://www.amazon.com/-/dp/B0771V1JZX');
|
|
38
|
-
const content = await page.content();
|
|
39
|
-
const matchData = content.match(/'initial': (.*)}/);
|
|
40
|
-
if (matchData === null || matchData.length === 0){
|
|
41
|
-
console.log('no images found');
|
|
42
|
-
} else {
|
|
43
|
-
const data = JSON.parse(matchData[1]);
|
|
44
|
-
const images = data.map(e => e.hiRes);
|
|
45
|
-
console.log('images=', images);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
await browser.close();
|
|
49
|
-
await GL.stop();
|
|
50
|
-
})();
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// Usage example: in the terminal enter
|
|
2
|
-
// node example-amazon.js yU0token yU0Pr0f1leiD
|
|
3
|
-
|
|
4
|
-
// your token api (located in the settings, api)
|
|
5
|
-
// https://github.com/gologinapp/gologin#usage
|
|
6
|
-
|
|
7
|
-
import GoLogin from 'gologin';
|
|
8
|
-
import puppeteer from 'puppeteer-core';
|
|
9
|
-
|
|
10
|
-
const [_execPath, _filePath, GOLOGIN_API_TOKEN, GOLOGIN_PROFILE_ID] = process.argv;
|
|
11
|
-
|
|
12
|
-
(async () => {
|
|
13
|
-
const GL = new GoLogin({
|
|
14
|
-
token: GOLOGIN_API_TOKEN,
|
|
15
|
-
profile_id: GOLOGIN_PROFILE_ID,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const { _status, wsUrl } = await GL.start();
|
|
19
|
-
const browser = await puppeteer.connect({
|
|
20
|
-
browserWSEndpoint: wsUrl.toString(),
|
|
21
|
-
ignoreHTTPSErrors: true,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const page = await browser.newPage();
|
|
25
|
-
|
|
26
|
-
const viewPort = GL.getViewPort();
|
|
27
|
-
await page.setViewport({ width: Math.round(viewPort.width * 0.994), height: Math.round(viewPort.height * 0.92) });
|
|
28
|
-
const session = await page.target().createCDPSession();
|
|
29
|
-
const { windowId } = await session.send('Browser.getWindowForTarget');
|
|
30
|
-
await session.send('Browser.setWindowBounds', { windowId, bounds: viewPort });
|
|
31
|
-
await session.detach();
|
|
32
|
-
|
|
33
|
-
await page.goto('https://www.amazon.com/-/dp/B0771V1JZX');
|
|
34
|
-
|
|
35
|
-
const content = await page.content();
|
|
36
|
-
const matchData = content.match(/'initial': (.*)}/);
|
|
37
|
-
if (matchData == null || matchData.length==0){
|
|
38
|
-
console.log('no images found');
|
|
39
|
-
} else {
|
|
40
|
-
const data = JSON.parse(matchData[1]);
|
|
41
|
-
const images = data.map(e => e.hiRes);
|
|
42
|
-
console.log('images=', images);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
await browser.close();
|
|
46
|
-
await GL.stop();
|
|
47
|
-
})();
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { exitAll, GologinApi } from '../src/gologin-api.js';
|
|
2
|
-
|
|
3
|
-
const token = process.env.GOLOGIN_API_TOKEN; // get token https://app.gologin.com/personalArea/TokenApi
|
|
4
|
-
const gologin = GologinApi({ token });
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
const { browser } = await gologin.launch({ cloud: true });
|
|
8
|
-
const page = await browser.newPage();
|
|
9
|
-
await page.goto('https://iphey.com/', { waitUntil: 'networkidle2' });
|
|
10
|
-
const status = await page.$eval('.trustworthy:not(.hide)', (elt) =>
|
|
11
|
-
elt?.innerText?.trim(),
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
return status; // Expecting 'Trustworthy'
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
main().catch(console.error).then(console.info).finally(exitAll);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Usage example: in the terminal enter
|
|
2
|
-
// node example-create-custom-profile.js yU0token
|
|
3
|
-
|
|
4
|
-
// your token api (located in the settings, api)
|
|
5
|
-
// https://github.com/gologinapp/gologin#usage
|
|
6
|
-
|
|
7
|
-
import GoLogin from 'gologin';
|
|
8
|
-
|
|
9
|
-
const [_execPath, _filePath, GOLOGIN_API_TOKEN] = process.argv;
|
|
10
|
-
|
|
11
|
-
(async () => {
|
|
12
|
-
const GL = new GoLogin({ token: GOLOGIN_API_TOKEN });
|
|
13
|
-
|
|
14
|
-
const profileId = await GL.createCustom({
|
|
15
|
-
os: 'win', // required param ('lin', 'mac', 'win', 'android'), for macM1 write (os: 'mac') and add property 'isM1'
|
|
16
|
-
// isM1: true,
|
|
17
|
-
name: 'testName',
|
|
18
|
-
fingerprint: {
|
|
19
|
-
autoLang: true,
|
|
20
|
-
resolution: '800x400',
|
|
21
|
-
language: 'de',
|
|
22
|
-
dns: 'testDNS',
|
|
23
|
-
hardwareConcurrency: 8,
|
|
24
|
-
deviceMemory: 4, // 0.5, 1, 2, 4, 6, 8
|
|
25
|
-
startUrl: 'https://testurl.com',
|
|
26
|
-
googleServicesEnabled: true,
|
|
27
|
-
lockEnabled: true,
|
|
28
|
-
// proxy: { // uncomment and check input if you need to use proxy
|
|
29
|
-
// mode: 'http', // 'socks4', 'socks5'
|
|
30
|
-
// host: '123.12.123.12',
|
|
31
|
-
// port: 1234,
|
|
32
|
-
// username: 'user',
|
|
33
|
-
// password: 'password',
|
|
34
|
-
// },
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
console.log('profile id=', profileId);
|
|
39
|
-
})();
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Usage example: in the terminal enter
|
|
2
|
-
// node example-create-profile.js yU0token
|
|
3
|
-
|
|
4
|
-
// your token api (located in the settings, api)
|
|
5
|
-
// https://github.com/gologinapp/gologin#usage
|
|
6
|
-
|
|
7
|
-
import GoLogin from 'gologin';
|
|
8
|
-
|
|
9
|
-
const [_execPath, _filePath, GOLOGIN_API_TOKEN] = process.argv;
|
|
10
|
-
|
|
11
|
-
(async () => {
|
|
12
|
-
const GL = new GoLogin({ token: GOLOGIN_API_TOKEN });
|
|
13
|
-
|
|
14
|
-
// the following parameters are required for profile creation
|
|
15
|
-
const profile_id = await GL.create({
|
|
16
|
-
name: 'profile_mac',
|
|
17
|
-
os: 'mac', // 'win', 'lin', 'android'
|
|
18
|
-
// isM1: true, // for Mac M1
|
|
19
|
-
navigator: {
|
|
20
|
-
language: 'en-US,en;q=0.9',
|
|
21
|
-
userAgent: 'random', // get random user agent for selected os
|
|
22
|
-
resolution: '1024x768',
|
|
23
|
-
},
|
|
24
|
-
proxyEnabled: false,
|
|
25
|
-
proxy: {
|
|
26
|
-
mode: 'none',
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
console.log('profile id=', profile_id);
|
|
31
|
-
await GL.update({
|
|
32
|
-
id: profile_id,
|
|
33
|
-
name: 'profile_mac2',
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const profile = await GL.getProfile(profile_id);
|
|
37
|
-
console.log('new profile name=', profile.name);
|
|
38
|
-
|
|
39
|
-
// await GL.delete(profile_id);
|
|
40
|
-
})();
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import puppeteer from 'puppeteer-core';
|
|
2
|
-
|
|
3
|
-
import GoLogin from '../src/gologin.js';
|
|
4
|
-
|
|
5
|
-
(async () => {
|
|
6
|
-
const GL = new GoLogin({
|
|
7
|
-
profile_id: 'yU0Pr0f1leiD',
|
|
8
|
-
token: 'yU0token',
|
|
9
|
-
args: ['--disable-background-timer-throttling', '--disable-backgrounding-occluded-windows', '--disable-renderer-backgrounding'],
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const { status, wsUrl } = await GL.start().catch((e) => {
|
|
13
|
-
console.trace(e);
|
|
14
|
-
|
|
15
|
-
return { status: 'failure' };
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
if (status !== 'success') {
|
|
19
|
-
console.log('Invalid status');
|
|
20
|
-
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const browser = await puppeteer.connect({
|
|
25
|
-
browserWSEndpoint: wsUrl.toString(),
|
|
26
|
-
ignoreHTTPSErrors: true,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const page = await browser.newPage();
|
|
30
|
-
await page.goto('https://myip.link/mini');
|
|
31
|
-
console.log(await page.content());
|
|
32
|
-
await browser.close();
|
|
33
|
-
await GL.stop();
|
|
34
|
-
})();
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import puppeteer from 'puppeteer-core';
|
|
2
|
-
|
|
3
|
-
import { updateProfileProxy, updateProfileResolution, updateProfileUserAgent } from '../src/browser/browser-api.js';
|
|
4
|
-
import GoLogin from '../src/gologin.js';
|
|
5
|
-
|
|
6
|
-
const token = 'yU0token';
|
|
7
|
-
const profile_id = 'yU0Pr0f1leiD';
|
|
8
|
-
|
|
9
|
-
(async () => {
|
|
10
|
-
const GL = new GoLogin({
|
|
11
|
-
token,
|
|
12
|
-
profile_id,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const { status, wsUrl } = await GL.start().catch((e) => {
|
|
16
|
-
console.trace(e);
|
|
17
|
-
|
|
18
|
-
return { status: 'failure' };
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
if (status !== 'success') {
|
|
22
|
-
console.log('Invalid status');
|
|
23
|
-
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const browser = await puppeteer.connect({
|
|
28
|
-
browserWSEndpoint: wsUrl.toString(),
|
|
29
|
-
ignoreHTTPSErrors: true,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const page = await browser.newPage();
|
|
33
|
-
await page.goto('https://myip.link/mini');
|
|
34
|
-
console.log(await page.content());
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @see updateProfileProxy
|
|
38
|
-
*/
|
|
39
|
-
const proxyData = {
|
|
40
|
-
mode: 'none',
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
await GL.changeProfileProxy(proxyData);
|
|
44
|
-
|
|
45
|
-
await GL.changeProfileResolution('1920x1080');
|
|
46
|
-
|
|
47
|
-
const userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.71 Safari/537.36';
|
|
48
|
-
await GL.changeProfileUserAgent(userAgent);
|
|
49
|
-
|
|
50
|
-
await browser.close();
|
|
51
|
-
await GL.stop();
|
|
52
|
-
})();
|
|
53
|
-
|
|
54
|
-
(async () => {
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @see updateProfileProxy
|
|
58
|
-
*/
|
|
59
|
-
const proxyData = {
|
|
60
|
-
mode: 'none',
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
await updateProfileProxy(profile_id, token, proxyData);
|
|
64
|
-
|
|
65
|
-
await updateProfileResolution(profile_id, token, '1920x1080');
|
|
66
|
-
|
|
67
|
-
const userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.71 Safari/537.36';
|
|
68
|
-
await updateProfileUserAgent(profile_id, token, userAgent);
|
|
69
|
-
})();
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import puppeteer from 'puppeteer-core';
|
|
2
|
-
|
|
3
|
-
import GoLogin from '../src/gologin.js';
|
|
4
|
-
|
|
5
|
-
const { connect } = puppeteer;
|
|
6
|
-
|
|
7
|
-
const delay = ms => new Promise(res => setTimeout(res, ms));
|
|
8
|
-
|
|
9
|
-
(async () => {
|
|
10
|
-
const GL = new GoLogin({
|
|
11
|
-
token: 'yU0token',
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const profile_id = await GL.create({
|
|
15
|
-
name: 'profile_gmail',
|
|
16
|
-
os: 'lin',
|
|
17
|
-
navigator: {
|
|
18
|
-
userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36',
|
|
19
|
-
resolution: '1280x720',
|
|
20
|
-
language: 'en-GB,en-US;q=0.9,en;q=0.8',
|
|
21
|
-
platform: 'Linux x86_64',
|
|
22
|
-
hardwareConcurrency: 8,
|
|
23
|
-
deviceMemory: 8,
|
|
24
|
-
maxTouchPoints: 5,
|
|
25
|
-
},
|
|
26
|
-
proxy: {
|
|
27
|
-
mode: 'http',
|
|
28
|
-
host: 'proxy_host',
|
|
29
|
-
port: 'proxy_port',
|
|
30
|
-
username: 'proxy_username',
|
|
31
|
-
password: 'proxy_password',
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
console.log('profile id=', profile_id);
|
|
36
|
-
GL.setProfileId(profile_id);
|
|
37
|
-
|
|
38
|
-
const { status, wsUrl } = await GL.start();
|
|
39
|
-
const browser = await connect({
|
|
40
|
-
browserWSEndpoint: wsUrl.toString(),
|
|
41
|
-
ignoreHTTPSErrors: true,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const page = await browser.newPage();
|
|
45
|
-
|
|
46
|
-
const viewPort = GL.getViewPort();
|
|
47
|
-
await page.setViewport({ width: Math.round(viewPort.width * 0.994), height: Math.round(viewPort.height * 0.92) });
|
|
48
|
-
const session = await page.target().createCDPSession();
|
|
49
|
-
const { windowId } = await session.send('Browser.getWindowForTarget');
|
|
50
|
-
await session.send('Browser.setWindowBounds', { windowId, bounds: viewPort });
|
|
51
|
-
await session.detach();
|
|
52
|
-
|
|
53
|
-
await page.goto('https://gmail.com');
|
|
54
|
-
await delay(1000);
|
|
55
|
-
await page.goto('https://accounts.google.com/signup/v2?service=mail&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&flowName=GlifWebSignIn&flowEntry=SignUp');
|
|
56
|
-
await delay(3000);
|
|
57
|
-
await page.type('#firstName', 'first_name', { delay: 100 });
|
|
58
|
-
await page.type('#lastName', 'last_name', { delay: 100 });
|
|
59
|
-
await page.type('#username', 'username', { delay: 100 });
|
|
60
|
-
await page.type('[name=Passwd]', 'pa$$w0rd', { delay: 100 });
|
|
61
|
-
await page.type('[name=ConfirmPasswd]', 'pa$$w0rd', { delay: 100 });
|
|
62
|
-
await page.click('#accountDetailsNext > div > button');
|
|
63
|
-
|
|
64
|
-
await delay(60000);
|
|
65
|
-
await browser.close();
|
|
66
|
-
await GL.stop();
|
|
67
|
-
})();
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { exitAll, GologinApi } from '../src/gologin-api.js';
|
|
2
|
-
|
|
3
|
-
const token = process.env.GOLOGIN_API_TOKEN; // get token https://app.gologin.com/personalArea/TokenApi
|
|
4
|
-
const gologin = GologinApi({ token });
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
const { browser } = await gologin.launch();
|
|
8
|
-
const page = await browser.newPage();
|
|
9
|
-
await page.goto('https://iphey.com/', { waitUntil: 'networkidle2' });
|
|
10
|
-
const status = await page.$eval('.trustworthy:not(.hide)', (elt) =>
|
|
11
|
-
elt?.innerText?.trim(),
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
return status; // Expecting 'Trustworthy'
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
main().catch(console.error).then(console.info).finally(exitAll);
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import puppeteer from 'puppeteer-core';
|
|
2
|
-
|
|
3
|
-
import GoLogin from '../src/gologin.js';
|
|
4
|
-
|
|
5
|
-
const { connect } = puppeteer;
|
|
6
|
-
|
|
7
|
-
(async () => {
|
|
8
|
-
const GL = new GoLogin({
|
|
9
|
-
token: 'yU0token',
|
|
10
|
-
profile_id: 'yU0Pr0f1leiD',
|
|
11
|
-
executablePath: '/usr/bin/orbita-browser/chrome',
|
|
12
|
-
tmpdir: '/my/tmp/dir',
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const wsUrl = await GL.startLocal();
|
|
16
|
-
const browser = await connect({
|
|
17
|
-
browserWSEndpoint: wsUrl.toString(),
|
|
18
|
-
ignoreHTTPSErrors: true,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const page = await browser.newPage();
|
|
22
|
-
await page.goto('https://myip.link');
|
|
23
|
-
console.log(await page.content());
|
|
24
|
-
await browser.close();
|
|
25
|
-
await GL.stopLocal({ posting: false });
|
|
26
|
-
})();
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import puppeteer from 'puppeteer-core';
|
|
2
|
-
|
|
3
|
-
import GoLogin from '../src/gologin.js';
|
|
4
|
-
|
|
5
|
-
const { connect } = puppeteer;
|
|
6
|
-
|
|
7
|
-
const delay = ms => new Promise(res => setTimeout(res, ms));
|
|
8
|
-
|
|
9
|
-
(async () => {
|
|
10
|
-
const GL = new GoLogin({
|
|
11
|
-
profile_id: 'yU0token',
|
|
12
|
-
token: 'yU0Pr0f1leiD',
|
|
13
|
-
executablePath: '/usr/bin/orbita-browser/chrome',
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const { status, wsUrl } = await GL.start();
|
|
17
|
-
const browser = await connect({
|
|
18
|
-
browserWSEndpoint: wsUrl,
|
|
19
|
-
ignoreHTTPSErrors: true,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const page = await browser.newPage();
|
|
23
|
-
await page.goto('https://www.walmart.com/account/profile');
|
|
24
|
-
if (await page.evaluate((e) => document.querySelector('#email'))){
|
|
25
|
-
// need login
|
|
26
|
-
await page.type('#email', 'myemail');
|
|
27
|
-
await page.type('#password', 'mypassword');
|
|
28
|
-
await page.click('[type=submit]');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
await page.goto('https://www.walmart.com/account/wmpurchasehistory');
|
|
32
|
-
await page.screenshot({ path: 'screenshot.jpg' });
|
|
33
|
-
await browser.close();
|
|
34
|
-
await GL.stop();
|
|
35
|
-
})();
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Usage example: in the terminal enter
|
|
2
|
-
// node example-stopremote.js yU0token yU0Pr0f1leiD
|
|
3
|
-
|
|
4
|
-
// your token api (located in the settings, api)
|
|
5
|
-
// https://github.com/gologinapp/gologin#usage
|
|
6
|
-
import GoLogin from '../src/gologin.js';
|
|
7
|
-
|
|
8
|
-
const GOLOGIN_API_TOKEN = process.argv[2];
|
|
9
|
-
// your profile id
|
|
10
|
-
const GOLOGIN_PROFILE_ID = process.argv[3];
|
|
11
|
-
|
|
12
|
-
(async () => {
|
|
13
|
-
const GL = new GoLogin({
|
|
14
|
-
token: GOLOGIN_API_TOKEN,
|
|
15
|
-
profile_id: GOLOGIN_PROFILE_ID,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// stop profile
|
|
19
|
-
await GL.stopRemote();
|
|
20
|
-
})();
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import puppeteer from 'puppeteer-core';
|
|
2
|
-
|
|
3
|
-
import GoLogin from '../src/gologin.js';
|
|
4
|
-
|
|
5
|
-
const { connect } = puppeteer;
|
|
6
|
-
|
|
7
|
-
const delay = ms => new Promise(res => setTimeout(res, ms));
|
|
8
|
-
|
|
9
|
-
(async () => {
|
|
10
|
-
const GL = new GoLogin({
|
|
11
|
-
token: 'yU0token',
|
|
12
|
-
profile_id: 'yU0Pr0f1leiD',
|
|
13
|
-
timezone: {
|
|
14
|
-
ip:'1.1.1.1',
|
|
15
|
-
timezone:'Europe/Amsterdam',
|
|
16
|
-
accuracy:100,
|
|
17
|
-
ll: ['52.3759','4.8975'],
|
|
18
|
-
country: 'NL',
|
|
19
|
-
city: 'Amsterdam',
|
|
20
|
-
stateProv:'',
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const { status, wsUrl } = await GL.start();
|
|
25
|
-
const browser = await connect({
|
|
26
|
-
browserWSEndpoint: wsUrl.toString(),
|
|
27
|
-
ignoreHTTPSErrors: true,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const page = await browser.newPage();
|
|
31
|
-
|
|
32
|
-
const viewPort = GL.getViewPort();
|
|
33
|
-
await page.setViewport({ width: Math.round(viewPort.width * 0.994), height: Math.round(viewPort.height * 0.92) });
|
|
34
|
-
const session = await page.target().createCDPSession();
|
|
35
|
-
const { windowId } = await session.send('Browser.getWindowForTarget');
|
|
36
|
-
await session.send('Browser.setWindowBounds', { windowId, bounds: viewPort });
|
|
37
|
-
await session.detach();
|
|
38
|
-
|
|
39
|
-
await page.goto('https://myip.link');
|
|
40
|
-
|
|
41
|
-
await delay(60000);
|
|
42
|
-
await browser.close();
|
|
43
|
-
await GL.stop();
|
|
44
|
-
})();
|