This commit is contained in:
caiwx86 2024-11-14 20:14:11 +08:00
parent c11854067b
commit 3ba34c34b4

View File

@ -39,11 +39,9 @@ class RmComicSpider(scrapy.Spider):
new_chapter = oldUtils().new_files(files=comic_item.get_chapters(), folder=cbz_dir)
# 清理多余章节
oldUtils().clean_old_files(files=comic_item.get_chapters(), folder=cbz_dir, move_folder=move_folder)
down_chapter = oldUtils().diff_cbz(cbz_dir=cbz_dir, chapters=new_chapter)
if len(down_chapter) > 0:
if len(oldUtils().diff_cbz(cbz_dir=cbz_dir, chapters=new_chapter)) > 0:
for chapter, link in zip(comic_item.get_chapters(), comic_item.get_chapter_href()):
#if ComicPath.chinese_convert(ComicPath.fix_file_name(chapter)) in new_chapter:
if ComicPath.chinese_convert(ComicPath.fix_file_name(chapter)) in down_chapter:
if ComicPath.chinese_convert(ComicPath.fix_file_name(chapter)) in new_chapter:
# 打包导出item数据
item = comic_item.load_item(chapter=chapter)
# 获取最终存放CBZ的路径
@ -51,7 +49,7 @@ class RmComicSpider(scrapy.Spider):
# 校验繁体和简体中文CBZ路径是否存在
if cbz_path !=None and os.path.exists(cbz_path):
logging.info(f"漫画 {cbz_path} 已存在, 跳过中...")
yield item
# yield item
else:
# 开始访问章节链接并跳转到self.parse_chapter
yield scrapy.Request(self.main_url+link, meta={'item': item}, callback=self.parse_chapter)