This commit is contained in:
caiwx86 2024-11-14 20:28:54 +08:00
parent 3ba34c34b4
commit 693a1fc9fd

View File

@ -74,17 +74,13 @@ class ImgDownloadPipeline(BaseImagesPipeline):
image_url, image_path = [ image_item["image_url"], image_item["image_path"]]
if image_item["image_type"] == "Icon":
image_path = super().get_file_path(item, result_type="icon_cache")
is_next = not super().image_scramble_exits(item, image_path)
# 图像(含加密图像)存在
if not is_next:
# if super().image_scramble_exits(item, image_path):
if os.path.exists(image_path):
logging.info(f"file exists: IMAGE_STORE {image_path}")
donwloaded_images.append(image_path)
logging.info(f"images count= {len(images_item)} downloaded_images_count= {len(donwloaded_images)}")
# 如果图像已全部下载则直接跳至下一步压缩CBZ
if len(donwloaded_images) == len(images_item):
logging.info(f"len(donwloaded_images) == len(images_item)")
self.download_done(item)
if is_next:
else:
logging.info(f"downloading {image_url} --> IMAGE_STORE {image_path}")
yield scrapy.Request(url=image_url, meta={'path': image_path })