-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
48 lines (32 loc) · 963 Bytes
/
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
require('dotenv').config()
if (!process.env.INSTA_USERNAME || !process.env.INSTA_PASSWORD) {
return console.log('create a .env with your instagram login credentials');
}
// npm
const puppeteer = require('puppeteer');
// actions
const startLiking = require('./actions/multiple/startLiking');
const checkForUnfollows = require('./actions/multiple/checkForUnfollows');
const initApp = require('./helpers/initApp');
// utils
const {
msToMin,
randBetween
} = require('./utils');
// settings
const settings = require('./settings.js');
(run = async () => {
console.log('starting');
try {
const { browser, cookies } = await initApp();
if (settings.likes && settings.likes.enabled) {
startLiking(settings.likes.tags, cookies, browser);
}
if (settings.follows && settings.follows.targetFollowCount) {
checkForUnfollows(cookies, browser);
}
} catch (e) {
console.error('TRY ME', e);
await run();
}
})();