示例#1
0
            thread = CrawlerThread(crawler)
            thread.start()
            threads.append(thread)
        except Exception:
            print("Interrupted")'''

if __name__ == '__main__':
    numThreads = input("Number of threads: ")
    maxDepth = input("Maximum depth: ")

    try:
        connection = Connection.Connection()
        connection.Start_Connection()
        Crawler.cursor = connection.cursor
        Crawler.db = connection.db
        Crawler.boot()

        threads = []

        for i in range(int(numThreads)):
            crawler = Crawler("", int(maxDepth))
            thread = CrawlerThread(crawler)
            thread.start()
            threads.append(thread)

        for t in threads:
            t.join()
        connection.Close_Connection()

    except:
        print("main")