parent
8c66703389
commit
2161f4ba01
|
@ -117,14 +117,36 @@ def launch_and_visit(use_tor, page_url, headless=False):
|
|||
browser_manager.close_browser(driver, tor_process)
|
||||
|
||||
if __name__ == "__main__":
|
||||
while True:
|
||||
threads = []
|
||||
NO_PROCESSES = 10
|
||||
threads = []
|
||||
|
||||
for i in range(0, 5):
|
||||
t1 = threading.Thread(target=launch_and_visit, args=(True, 'https://giangillorossi.altervista.org', True))
|
||||
while True:
|
||||
if len(threads) < NO_PROCESSES:
|
||||
print(f"[BOT] Starting thread n.{len(threads)}/{NO_PROCESSES}")
|
||||
t1 = threading.Thread(target=launch_and_visit, args=(False, 'https://giangillorossi.altervista.org', False))
|
||||
t1.start()
|
||||
|
||||
threads.append(t1)
|
||||
|
||||
for t in threads:
|
||||
t.join()
|
||||
i = 0
|
||||
while i < len(threads):
|
||||
# print(i)
|
||||
if not (threads[i].is_alive()):
|
||||
print(f"[BOT] Thread n.{i} has stopped, removing from list")
|
||||
threads.pop(i)
|
||||
|
||||
else:
|
||||
i += 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# for i in range( 0, 5):
|
||||
# t1 = threading.Thread(target=launch_and_visit, args=(True, 'https://giangillorossi.altervista.org', True))
|
||||
# t1.start()
|
||||
|
||||
# threads.append(t1)
|
||||
|
||||
# for t in threads:
|
||||
# t.join()
|
||||
|
|
Loading…
Reference in New Issue