-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathone-time-use-profile.js
More file actions
31 lines (23 loc) · 917 Bytes
/
one-time-use-profile.js
File metadata and controls
31 lines (23 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// You need to create profile add proxy, use it with puppetter and then delete it
import { GologinApi } from '../../src/gologin-api.js';
const token = process.env.GL_API_TOKEN || 'your dev token here';
const gologin = GologinApi({
token,
});
async function main() {
const profile = await gologin.createProfileRandomFingerprint();
const profileId = profile.id;
await gologin.addGologinProxyToProfile(profileId, 'US');
const { browser } = await gologin.launch({ profileId });
const page = await browser.newPage();
await page.goto('https://iphey.com/', { waitUntil: 'networkidle2' });
const status = await page.$eval('.trustworthy:not(.hide)',
(elt) => elt?.innerText?.trim(),
);
await new Promise((resolve) => setTimeout(resolve, 10000));
console.log('status', status);
await gologin.deleteProfile(profileId);
return status;
}
main().catch(console.error)
.finally(gologin.exit);