From 2a3b2ee52f45b19d81b11a180403046c1db53b03 Mon Sep 17 00:00:00 2001 From: wkyuu Date: Sat, 30 Apr 2022 20:57:30 +0800 Subject: [PATCH] update via git --- middlewares.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/middlewares.py b/middlewares.py index 7f89cd1..2e2b1ba 100644 --- a/middlewares.py +++ b/middlewares.py @@ -63,7 +63,7 @@ def write2csv(category, response): # 写入csv文件 filename_csv = os.getcwd() + "\\Catalogues\\" + FILENAME_CSV.get(category) pipelines.write2csv(response, filename_csv) -class milkSpider: +class milkSpider: # 定义一个爬虫类 def __init__(self, url): self.url = url self.category = getCategory(url) @@ -73,7 +73,7 @@ class milkSpider: print("write2csv for '{}' was started.".format(self.url)) write2csv(self.category, self.response) -def mainThread(): +def mainThread(): # 主线程,配置线程池状况,实例化爬虫对象 try: with ThreadPoolExecutor(max_workers = 8) as thread: while True: