-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
48 lines (40 loc) · 1.3 KB
/
index.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
36
37
38
39
40
41
42
43
44
45
46
47
48
import fs from 'fs';
import dotenv from 'dotenv';
import { loginUser } from './libs/api';
import { formatProxy } from './libs/proxy';
import config from './config/config.json';
import Task from './libs/task';
dotenv.config();
let tasks = [];
(async () => {
if (config.accounts.length === 0) throw new Error('Please add accounts you wished to monitor!');
// read proxies file
const text = fs.readFileSync('./proxy.txt', 'utf-8');
const proxies =
text == ''
? []
: formatProxy(
text
.replace(/\r/g, '')
.trim()
.split('\n')
);
console.log(`Loaded ${proxies.length} proxies!`);
// const authenticated = await loginUser(process.env.IG_USER, process.env.IG_PASS);
for (let i = 0; i < config.accounts.length; i++) {
tasks.push(new Task(config, config.accounts[i], proxies));
tasks[i].start();
}
// if (authenticated) {
// console.log('Successfully logged into account!');
// for (let i = 0; i < config.accounts.length; i++) {
// tasks.push(new Task(config, config.accounts[i], proxies));
// tasks[i].start();
// }
// } else {
// console.log(
// 'Failed to authenticate, most likely rate limit. Please wait for at least 5 min to start back monitor!'
// );
// process.exit(1);
// }
})();