-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathexample.py
More file actions
26 lines (22 loc) · 1.19 KB
/
example.py
File metadata and controls
26 lines (22 loc) · 1.19 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
from utils import solver
import time
from playwright.sync_api import sync_playwright
import concurrent.futures
import colorama
def solve_test():
with sync_playwright() as playwright:
s = solver.Solver(playwright, headless=False)
while True:
current_time = time.time()
captcha = s.solve("https://modrinth.com/auth/sign-up", "0x4AAAAAAAHWfmKCm7cUG869", invisible=True) # using the same solver instance dispense us from launching a new browser every time
if captcha == "failed":
print(f"{colorama.Fore.WHITE}[{colorama.Fore.RED}-{colorama.Fore.WHITE}] Failed to solve captcha")
continue
print(f"{colorama.Fore.WHITE}[{colorama.Fore.GREEN}+{colorama.Fore.WHITE}] Solved {captcha[0:40]} in {colorama.Fore.GREEN}{time.time() - current_time}{colorama.Fore.WHITE} seconds")
def main():
with concurrent.futures.ThreadPoolExecutor(max_workers=6) as executor:
for i in range(2):
print(f"{colorama.Fore.WHITE}[{colorama.Fore.GREEN}+{colorama.Fore.WHITE}] Starting thread {colorama.Fore.GREEN}{i+1}{colorama.Fore.WHITE}")
executor.submit(solve_test)
if __name__ == "__main__":
main()