-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathmain.py
More file actions
44 lines (37 loc) · 1.78 KB
/
Copy pathmain.py
File metadata and controls
44 lines (37 loc) · 1.78 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
import os, random, time, json, itertools
from selenium import webdriver
import undetected_chromedriver as uc
from fake_useragent import UserAgent
from colorama import Fore
class Viewbot:
def __init__(self):
self.config = json.load(open('./data/config.json', 'r+'))
self.proxies = itertools.cycle(open('./data/proxies.txt').read().splitlines())
self.ua = UserAgent()
def ui(self):
os.system('cls && title Youtube Viewbot ^| github.com/Plasmonix' if os.name == "nt" else 'clear')
print(f"""{Fore.RED}
__ __ _ _ _____ _ _ _
| | |___ _ _| |_ _ _| |_ ___ | | |_|___ _ _ _| |_ ___| |_
|_ _| . | | | _| | | . | -_| | | | | -_| | | | . | . | _|
|_| |___|___|_| |___|___|___| \___/|_|___|_____|___|___|_|
{Fore.RESET}""")
def open_url(self, ua, sleep_time, proxy):
self.options = webdriver.ChromeOptions()
self.options.add_argument("--incognito")
self.options.add_argument('--start-maximized')
self.options.add_argument('user-agent=%s' % ua.random)
self.options.add_argument("--proxy-server=%s" % proxy)
self.options.headless = True
self.browser = uc.Chrome(options=self.options)
self.browser.get(self.config["url"])
time.sleep(sleep_time)
self.browser.quit()
def main(self):
self.ui()
for _ in range(self.config["views"]):
self.sleeptime = random.randint(self.config["min_watch"], self.config["max_watch"])
self.open_url(self.ua, self.sleeptime, next(self.proxies))
if __name__ == "__main__":
bot = Viewbot()
bot.main()