-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstagramWork.py
81 lines (68 loc) · 2.66 KB
/
InstagramWork.py
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
76
77
78
79
80
81
import subprocess
import cv2
import pyautogui
import time
import ImageManipulation as Imp
import CommentGenerator as Cmg
import random
import clipboard
#import tensorflow as tf
import numpy as np
tags = ["travel", "portrait", "backpacking", "photography", "model", "wonderlust", "fashion", "nikkon",
"sony"]
#model = tf.keras.models.load_model("ModelLocal.h5")
old_author = "Johnny Karate"
for i in range(50):
base = "https://www.instagram.com/explore/tags/"
file = base + random.choice(tags) + "/"
#open a page out of the file tags list and open a picture
subprocess.Popen("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe " + file)
time.sleep(8)
pyautogui.moveTo(x=500, y=489, duration=2)
pyautogui.scroll(int(-500*random.random()) - 500)
time.sleep(1 + random.random())
pyautogui.scroll(int(-500*random.random()) - 500)
time.sleep(1 + random.random())
pyautogui.scroll(int(-500*random.random()) - 500)
time.sleep(1 + random.random())
pyautogui.click()
time.sleep(3)
if not Imp.isHeartRed(): # this means there is no empty heart on the screen
pass
else:
pyautogui.moveTo(x=500, y=589, duration=0.5)
pyautogui.click()
time.sleep(3)
for iterable in range(20 + int(30*random.random())):
if Imp.isHeartRed():
pyautogui.moveTo(x=1450, y=580, duration=2)
pyautogui.click()
continue
pyautogui.doubleClick(x=800, y=570, duration=2)
time.sleep(1)
if Imp.isHeartRed() and random.random() < 0.3:
[present, x_box, y_box] = Imp.returnCommentBoxCoordinates()
if present:
pyautogui.moveTo(x=x_box, y=y_box, duration=0.5)
time.sleep(random.random())
pyautogui.click()
comment = Cmg.getcomment("", "")
pyautogui.typewrite(comment, interval=0.15)
[present, x_post, y_post] = Imp.returnPostBoxCoordinates()
pyautogui.moveTo(x=x_post, y=y_post, duration=0.3)
time.sleep(2 + random.random())
pyautogui.click()
else:
print("WTF?")
pyautogui.moveTo(x=1450, y=580, duration=2)
pyautogui.click()
time.sleep(2 + 2*random.random())
# close the page and wait before the next start of likes
pyautogui.hotkey('ctrl', 'w') # ctrl-w to clsoe window
cv2.imshow("screenshot", Imp.get_resized_screenshot())
cv2.waitKey(100)
time.sleep(60 + 60*random.random())
time.sleep(60 + 60*random.random())
time.sleep(60 + 60*random.random())
time.sleep(60 + 60*random.random())
# os.remove("screenshot.png")