Created
August 11, 2021 15:11
-
-
Save AnderRV/d44904ad54641828e66533e652a8e172 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def queue_worker(i, q): | |
while True: | |
url = q.get() | |
if (len(visited) < max_visits and url not in visited): | |
crawl(url) | |
q.task_done() | |
q = queue.Queue() | |
num_workers = 4 | |
for i in range(num_workers): | |
Thread(target=queue_worker, args=(i, q), daemon=True).start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment