This commit is contained in:
caiwx86 2022-12-18 13:00:00 +08:00
parent d1ca41de63
commit 831604101a

View File

@ -8,7 +8,9 @@ from utils.downloader import download_images
from utils.Ntfy import ntfy
class comicEntity:
count_chapter = 0
@classmethod
def baseComicData(cls,url):
data = htmlUtils.xpathData('//script[@id="__NEXT_DATA__"]/text()',url=url)
@ -75,15 +77,13 @@ class comicEntity:
comicInfo.setListChapter(chapters)
#comicUtils.setComic(title,alias,icon,author,tags,action,dep,update_date,chapters,chapter_href)
count_chapter = 0
cls.count_chapter = 0
for href in chapter_href:
chapter = chapters[count_chapter]
comicInfo.setChapterName(chapter)
if not comicInfo.nextExistsGetPath("done_"):
comicEntity.comicChapter(href,scramble=True,sleep=random.randint(15,25))
count_chapter += 1
lenChapters = comicInfo.getLenChapters()
ntfy.sendMsg(f"预计总章节大小:{count_chapter} / {lenChapters}")
cls.count_chapter += 1
#一本漫画下载后等待
#清空文件夹
pathDirComic = comicInfo.getDirComic()
@ -115,10 +115,11 @@ class comicEntity:
print(f"文件已删除: {remove_path}")
except:
dirComicChapter = str(comicInfo.getDirComicChapter)
if not dirComicChapter == None and os.path.exists(dirComicChapter):
if dirComicChapter != None and os.path.exists(dirComicChapter):
shutil.rmtree(dirComicChapter)
cls.comicChapter(chapter_url,scramble,sleep)
if not sleep == None:
if sleep != None:
ntfy.sendMsg(f"预计总章节大小:{cls.count_chapter} / "+ comicInfo.getLenChapters())
ntfy.sendMsg(f"{sleep} 秒后开始下载下一个章节")
time.sleep(sleep)