gologin 2.1.19 → 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.
@@ -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
- })();