PyComicPackRouMan/entity/down/BaoZi.py
2023-01-23 09:40:53 +08:00

26 lines
1001 B
Python

import hashlib
import json
import os
from utils.HtmlUtils import htmlUtils
from utils.FileUtils import imageUtils
from utils.comic.ComicInfo import comicInfo
from utils.Ntfy import ntfy
class comicCommon:
@classmethod
def comicChapterDownload(cls,chapter_url):
imgs_url =htmlUtils.xpathData("//div[@class='gb-inside-container']/img/@data-src",url=chapter_url,update=True)
# pages_imgs =htmlUtils.xpathData("//div[@class='center scramble-page']/@id",url=chapter_url)
#print("img_list:",len(img_list))
list_img = []
list_file_name = []
count = 1
for i in imgs_url:
img_su = str(i).split('.')[-1]
count_image = "{:0>3d}".format(count)
list_file_name.append(count_image+"."+img_su)
list_img.append(count_image)
count += 1
comicInfo.setPages(list_img)
comicInfo.writeComicInfoXML(comicInfo.str_chapter)
comicInfo.comicChapterDownload(imgs_url,list_file_name)