-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
62 lines (50 loc) · 1.7 KB
/
Copy pathindex.js
File metadata and controls
62 lines (50 loc) · 1.7 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { launch } from "puppeteer";
import { Solver } from "2captcha-ts";
import { readFileSync } from "fs";
const solver = new Solver("d49d49bb671bb67b824371ec60f71513");
const example = async () => {
// const browser = await launch({
// headless: false,
// devtools: true
// })
// const [page] = await browser.pages()
// const preloadFile = readFileSync('./inject.js', 'utf8');
// await page.evaluateOnNewDocument(preloadFile);
// // Here we intercept the console messages to catch the message logged by inject.js script
// page.on('console', async (msg) => {
// const txt = msg.text()
// console.log("msg ==> ", txt)
// if (txt.includes('intercepted-params:')) {
// const params = JSON.parse(txt.replace('intercepted-params:', ''))
// console.log(params)
// try {
// console.log(`Solving the captcha...`)
// const res = await solver.cloudflareTurnstile(params)
// console.log(`Solved the captcha ${res.id}`)
// console.log(res)
// await page.evaluate((token) => {
// cfCallback(token)
// }, res.data)
// } catch (e) {
// console.log(e.err)
// return process.exit()
// }
// } else {
// return;
// }
// })
// page.goto('https://rucaptcha.com/42')
const browser = await launch({
headless: false,
});
const page = await browser.newPage();
await page.goto('https://sequelize.org/docs/v7/querying/operators/');
const data = {
browser,
page,
};
console.log('before==>', data);
await data.browser.close();
console.log('after==>', data);
};
example();