Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try:
- from selenium import webdriver
- import time, os, ctypes, requests
- from colorama import Fore, init
- import warnings, selenium, platform
- except ImportError:
- input("Error while importing modules. Please install the modules in requirements.txt")
- init(convert = True, autoreset = True)
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- clear = "clear"
- if platform.system() == "Windows":
- clear = "cls"
- os.system(clear)
- ascii_text = f"""{Fore.RED}
- ████████▀▀▀████
- ████████────▀██
- ████████──█▄──█
- ███▀▀▀██──█████
- █▀──▄▄██──█████
- █──█████──█████
- █▄──▀▀▀──▄█████
- ███▄▄▄▄▄███████ https://discord.gg/b7eBSv6Vdd
- """
- class automator:
- def __init__(self):
- options = webdriver.ChromeOptions()
- options.add_argument('--ignore-certificate-errors')
- options.add_experimental_option("excludeSwitches", ["enable-logging"])
- self.xpaths = {
- "followers": "/html/body/div[4]/div[1]/div[3]/div/div[1]/div/button",
- "likes": "/html/body/div[4]/div[1]/div[3]/div/div[2]/div/button",
- "views": "/html/body/div[4]/div[1]/div[3]/div/div[4]/div/button",
- "shares": "/html/body/div[4]/div[1]/div[3]/div/div[5]/div/button"
- }
- try:
- self.driver = webdriver.Chrome(options = options)
- except Exception as e:
- self.error(f"Error trying to load web driver: {e}")
- self.status = {}
- self.sent = 0
- self.cooldowns = 0
- self.ratelimits = 0
- def check_status(self):
- for xpath in self.xpaths:
- value = self.xpaths[xpath]
- element = self.driver.find_element_by_xpath(value)
- if not element.is_enabled():
- self.status.update({xpath: "[OFFLINE]"})
- else:
- self.status.update({xpath: ""})
- def check_for_captcha(self):
- while True:
- try:
- if "Enter the word" not in self.driver.page_source:
- return
- except:
- return
- os.system(clear)
- print(ascii_text)
- print(f"{self.console_msg('Error')} Complete the CAPTCHA in the driver.")
- time.sleep(1)
- def console_msg(self, status):
- colour = Fore.RED
- if status == "Success":
- colour = Fore.GREEN
- return f" {Fore.WHITE}[{colour}{status}{Fore.WHITE}]"
- def update_ascii(self):
- options = f"""
- {self.console_msg("1")} Follower Bot {Fore.RED}{self.status["followers"]}
- {self.console_msg("2")} Like Video Bot {Fore.RED}{self.status["likes"]}
- {self.console_msg("3")} View Bot {Fore.RED}{self.status["views"]}
- {self.console_msg("4")} Share Bot {Fore.RED}{self.status["shares"]}
- """
- return ascii_text + options
- def check_url(self, url):
- redirect = True
- if "vm.tiktok.com/" in url:
- redirect = False
- if redirect:
- if "/video/" not in url:
- return False
- session = requests.Session()
- r = session.get(url, allow_redirects=redirect)
- if redirect:
- if r.status_code == 200:
- return True
- return False
- location = r.headers["Location"]
- if "/video" in location:
- return True
- return False
- def convert(self, min, sec):
- seconds = 0
- if min != 0:
- answer = int(min) * 60
- seconds += answer
- seconds += int(sec) + 15
- return seconds
- def check_submit(self, div):
- remaining = f"/html/body/div[4]/div[{div}]/div/div/h4"
- try:
- element = self.driver.find_element_by_xpath(remaining)
- except:
- return None, None
- if "READY" in element.text:
- return True, True
- if "seconds for your next submit" in element.text:
- output = element.text.split("Please wait ")[1].split(" for")[0]
- minutes = element.text.split("Please wait ")[1].split(" ")[0]
- seconds = element.text.split("(s) ")[1].split(" ")[0]
- sleep_duration = self.convert(m
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement