-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
35 lines (33 loc) · 1.09 KB
/
main.js
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
const puppeteer = require('puppeteer');
const proxyChain = require('proxy-chain');
const fs = require('fs');
const readline = require('readline');
const proxys = fs.readFileSync('proxy.txt', 'utf8').split('\n');
const checkProxy = async (proxy) => {
try{
const aproxy = await proxyChain.anonymizeProxy(proxy);
const browser = await puppeteer.launch({
args: [`--proxy-server=${aproxy}`],
});
const page = await browser.newPage();
await page.goto('https://iphub.info/');
await new Promise(resolve => setTimeout(resolve, 30000));
const type = await page.evaluate(() => {
return document.querySelector('#type').innerHTML;
});
console.log(type);
fs.appendFileSync(`${type}.txt`, `${proxy}\n`);
//await page.screenshot({path: 'example.png', fullPage: true});
await browser.close();
await proxyChain.closeAnonymizedProxy(aproxy, true);
}catch(e){
console.log("Error");
}
};
const main = async () => {
for (let i = 0; i < proxys.length; i++) {
console.log(proxys[i]);
await checkProxy(proxys[i]);
}
}
main();