-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathmain.py
More file actions
75 lines (68 loc) · 1.76 KB
/
main.py
File metadata and controls
75 lines (68 loc) · 1.76 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
63
64
65
66
67
68
69
70
71
72
73
74
75
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup as b
import time
import login
import getpages
username = 'username'
password = 'password'
driver = 0
refs = []
max_likes = 350
max_follows = 50
def main():
global driver
print('running script..')
driver = webdriver.Chrome('C://Users/Ryan/Desktop/chromedriver.exe')
l = login.Login(driver, username, password)
l.signin()
gp = getpages.Getpages(driver)
refs = gp.get_followers()
print(gp.get_num_flw())
run_bot(refs, driver, gp)
def run_bot(refs, driver, gp):
print(len(refs))
print('accounts targeted')
t = time.time()
#how many pages we likes / followed
L = 0
F = 0
for r in refs:
driver.get('https://www.instagram.com' + r)
time.sleep(2)
if gp.get_num_flw() < 3000:
if gp.is_public():
print('public account')
print('current likes: ' + str(L))
if L < max_likes:
try:
gp.like_post()
L += 1
print("POST LIKED")
except:
print('could not like..lets follow instead')
try:
gp.follow_page()
print('page followed successfully')
F += 1
except:
print('could not follow')
else:
time.sleep(3600) # time.sleep(3600 - (time.time() - t)) -> t= time.time()
else:
print('account is private')
print('current follows: ' + str(F))
if F < max_follows:
time.sleep(2)
try:
gp.follow_page()
print('page followed successfully')
F += 1
except:
print('could not follow')
else:
time.sleep(3600)
if __name__ == '__main__':
main()