-
Notifications
You must be signed in to change notification settings - Fork 1
/
tiktok.like-comment.py
79 lines (61 loc) · 2.07 KB
/
tiktok.like-comment.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
import random
from autoclick import helpers, db
from autoclick.helpers import device, tap, random_sleep
total_like = 0
total_comment = 0
def search_like_button():
return device(descriptionContains="Like video", className="android.widget.Button")
def scroll_page():
return helpers.device.swipe(292, 1050, 292, 163, 0.1)
def close_comment():
close_comment = device(descriptionContains="Close comments")
if close_comment:
position = close_comment.center()
tap(position[0], position[1])
def auto_comment():
global total_comment
random_sleep()
has_comment_button = device(
className="android.widget.Button",
descriptionContains="Read or add comments",
)
# klik tombol komentar
if has_comment_button:
position = has_comment_button.center()
tap(position[0], position[1])
random_sleep()
has_comment_input = device(
className="android.widget.EditText", textContains="Add comment"
)
if has_comment_input:
position = has_comment_input.center()
tap(position[0], position[1])
tap(position[0], position[1])
comment_text = random.choice(db.comments)
print(f"comment: {comment_text}")
has_comment_input.set_text(comment_text)
random_sleep()
submit_button = device(
className="android.widget.ImageView",
descriptionContains="Post comment",
).center()
tap(submit_button[0], submit_button[1])
total_comment += 1
random_sleep()
while True:
if random.randint(1, 999) % 2 == 1:
continue
random_sleep()
has_like_button = search_like_button()
if has_like_button:
position = has_like_button.center()
tap(x=position[0], y=position[1])
print("Like")
total_like += 1
if random.randint(1, 999) % 2 == 1:
auto_comment()
close_comment()
random_sleep()
print(f"like: {total_like}")
print(f"comment: {total_comment}")
scroll_page()