-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bot.pyw
273 lines (248 loc) · 9.3 KB
/
Bot.pyw
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
import time
import random
import tkinter
import customtkinter
import threading
import requests
import webbrowser as wb
from selenium import webdriver
from selenium.webdriver.common.by import By
import chromedriver_autoinstaller
def main():
customtkinter.set_appearance_mode("System")
customtkinter.set_default_color_theme("blue")
app = customtkinter.CTk()
app.geometry("800x600")
app.title("YouTube View Bot")
app.after(201, lambda: app.iconbitmap("Icon.ico"))
def stream_option():
if stream_switch.get() == 1:
stream_switch.pack_forget()
headless.pack_forget()
mute.pack_forget()
view_label.pack_forget()
view_slider.pack_forget()
tab_box.pack_forget()
watchtime_box.pack_forget()
link_box.pack_forget()
start_button.pack_forget()
progress.pack_forget()
stream_switch.pack(pady=10, padx=10)
headless.pack(pady=10, padx=10)
mute.pack(pady=10, padx=10)
stream_bot_label.pack(pady=10, padx=10)
bots_watching.pack(pady=10, padx=10)
stream_link.pack(pady=10, padx=10)
stream_start_button.pack(pady=10, padx=10)
else:
stream_switch.pack_forget()
headless.pack_forget()
mute.pack_forget()
stream_bot_label.pack_forget()
bots_watching.pack_forget()
stream_link.pack_forget()
stream_start_button.pack_forget()
stream_switch.pack(pady=10, padx=10)
headless.pack(pady=10, padx=10)
mute.pack(pady=10, padx=10)
view_label.pack(pady=10, padx=10)
view_slider.pack(pady=10, padx=10)
tab_box.pack(pady=10, padx=10)
watchtime_box.pack(pady=10, padx=10)
link_box.pack(pady=10, padx=10)
start_button.pack(pady=10, padx=10)
progress.pack(pady=10, padx=10)
def views_update(self):
view_value = str(int(view_slider.get()))
view_label.configure(text=f"{view_value} Views")
def stream_bots_update(self):
stream_bot_value = str(int(bots_watching.get()))
stream_bot_label.configure(text=f"{stream_bot_value} Bots")
def update():
def open_updates():
wb.open(
f"https://github.com/sryu1/YouTube_View_Bot/releases/tag/{latest_version}"
)
update_window.destroy()
def destroy_update_window():
update_window.destroy()
ghrapi = requests.get(
"https://api.github.com/repos/sryu1/YouTube_View_Bot/releases/latest"
)
current_version = "v1.3.0"
latest_version = str(ghrapi.json()["name"])
if current_version < latest_version:
update_window = customtkinter.CTkToplevel()
update_window.geometry("300x120")
update_window.title("Update")
# create label on CTkToplevel window
update_label = customtkinter.CTkLabel(
update_window,
text=f"A new update ({latest_version}) has been released!",
)
update_close_button = customtkinter.CTkButton(
master=update_window, command=destroy_update_window, text="Close"
)
update_button = customtkinter.CTkButton(
master=update_window, command=open_updates, text="Update"
)
update_label.pack(side="top", fill="both", expand=True, padx=20, pady=20)
update_button.pack()
update_close_button.pack()
def start_bot():
stream_switch.pack_forget()
chromedriver_autoinstaller.install()
viewcount = 0
drivers = []
sites = [
"https://search.yahoo.com/",
"https://duckduckgo.com/",
"https://www.google.com/",
"https://www.bing.com/",
"https://t.co/",
"https://youtube.com/",
"https://www.ecosia.org/",
"https://www.reddit.com/",
"https://www.twitch.tv/",
"https://www.instagram.com/",
"https://www.tiktok.com/",
"https://search.brave.com",
]
views = int(view_slider.get())
number_of_drivers = int(tab_box.get())
time_to_refresh = int(watchtime_box.get())
url = link_box.get()
for i in range(number_of_drivers):
options = webdriver.ChromeOptions()
if headless.get() == 1:
options.add_argument("--headless")
if mute.get() == 1:
options.add_argument("--mute-audio")
options.add_experimental_option("excludeSwitches", ["enable-logging"])
drivers.append(
webdriver.Chrome(options=options, executable_path=r"chromedriver")
)
drivers[i].get(random.choice(sites))
drivers[i].get(url)
drivers[i].find_element(By.CLASS_NAME, "ytp-large-play-button").click()
while True:
time.sleep(time_to_refresh)
viewcount += number_of_drivers
progress.set(viewcount / views)
if int(views) <= int(viewcount):
drivers[i].quit()
exit()
elif int(views) > int(viewcount):
for i in range(number_of_drivers):
drivers[i].refresh()
def stream_start():
stream_switch.pack_forget()
chromedriver_autoinstaller.install()
drivers = []
sites = [
"https://search.yahoo.com/",
"https://duckduckgo.com/",
"https://www.google.com/",
"https://www.bing.com/",
"https://t.co/",
"https://youtube.com/",
"https://www.ecosia.org/",
"https://www.reddit.com/",
"https://www.twitch.tv/",
"https://www.instagram.com/",
"https://www.tiktok.com/",
"https://search.brave.com",
]
number_of_bots = int(bots_watching.get())
url = stream_link.get()
for i in range(number_of_bots):
options = webdriver.ChromeOptions()
if headless.get() == 1:
options.add_argument("--headless")
if mute.get() == 1:
options.add_argument("--mute-audio")
options.add_experimental_option("excludeSwitches", ["enable-logging"])
drivers.append(
webdriver.Chrome(options=options, executable_path=r"chromedriver")
)
drivers[i].get(random.choice(sites))
drivers[i].get(url)
drivers[i].find_element(By.CLASS_NAME, "ytp-large-play-button").click()
def stop():
drivers[i].quit()
global stopped
stopped = True
stopped = False
stop_button = customtkinter.CTkButton(
master=border, command=stop, text="Stop Bot"
)
stop_button.pack(pady=10, padx=10)
if stopped:
exit()
# Border
border = customtkinter.CTkFrame(master=app)
border.pack(pady=20, padx=20, fill="both", expand=True)
# Stream Option
stream_switch = customtkinter.CTkSwitch(
master=border, text="Stream Mode", command=stream_option
)
stream_switch.pack(pady=10, padx=10)
# Checkbox
headless = customtkinter.CTkCheckBox(master=border, text="Headless Mode")
headless.pack(pady=10, padx=10)
mute = customtkinter.CTkCheckBox(master=border, text="Mute")
mute.pack(pady=10, padx=10)
# Bot Progress
progress = customtkinter.CTkProgressBar(master=border)
progress.set(0.0)
# Number of views
view_value = 20
view_label = customtkinter.CTkLabel(
master=border, justify=tkinter.LEFT, text=f"{view_value} Views"
)
view_slider = customtkinter.CTkSlider(
master=border, from_=1, to=50, command=views_update
)
view_label.pack(pady=10, padx=10)
view_slider.pack(pady=10, padx=10)
view_slider.set(20)
# Number of tabs
tab_box = customtkinter.CTkEntry(
master=border, width=200, placeholder_text="Number of tabs"
)
tab_box.pack(pady=10, padx=10)
# Watch time
watchtime_box = customtkinter.CTkEntry(
master=border, width=200, placeholder_text="Watch time (seconds)"
)
watchtime_box.pack(pady=10, padx=10)
# Link
link_box = customtkinter.CTkEntry(master=border, width=400, placeholder_text="Link")
link_box.pack(pady=10, padx=10)
# Stream Menu
stream_bot_value = 5
stream_bot_label = customtkinter.CTkLabel(
master=border, justify=tkinter.LEFT, text=f"{stream_bot_value} Bots"
)
bots_watching = customtkinter.CTkSlider(
master=border, from_=1, to=50, command=stream_bots_update
)
bots_watching.set(5)
stream_link = customtkinter.CTkEntry(
master=border, width=400, placeholder_text="Link"
)
stream_start_button = customtkinter.CTkButton(
master=border, text="Start Bot", command=stream_start
)
# Start Button
start_button = customtkinter.CTkButton(
master=border,
command=threading.Thread(target=start_bot).start,
text="Start Bot",
)
start_button.pack(pady=10, padx=10)
progress.pack(pady=10, padx=10)
update()
app.mainloop()
if __name__ == "__main__":
main()