jack 1 жил өмнө
parent
commit
8009314d82
1 өөрчлөгдсөн 2 нэмэгдсэн , 1 устгасан
  1. 2 1
      flaticon/flaticon.py

+ 2 - 1
flaticon/flaticon.py

@@ -16,6 +16,7 @@ from playwright.sync_api import sync_playwright
 target = 'flaticon'
 step = 4  # 1 = 获取img链接, 2 = 下载图片, 3 = 1 + 2, 4 = 调试
 local_proxy = 0
+thread_count = 8
 title_selector = '#pack-view__inner > section.pack-view__header > h1'  # 获取标题选择器
 img_selector = '#pack-view__inner > section.search-result > ul > li:nth-child({}) > div > a > img'  # 获取图片的url
 img_count_selector = '#pack-view__inner > section.pack-view__header > p'  # 获取图片总数选择器
@@ -135,7 +136,7 @@ def open_browser(target_urls):
 
 def download_img(load_data, target_file_path):
     print('正在下载图片')
-    with ThreadPoolExecutor(max_workers=4) as executor:
+    with ThreadPoolExecutor(max_workers=thread_count) as executor:
         executor.map(single_img_download,
                      [(index, data, load_data, target_file_path) for index, data in enumerate(load_data)])