update version
This commit is contained in:
1 parent
57a0ae6841
commit
c62151bc71
25 files changed
+1271
-1408
No files matched your search
@@ -0,0 +1,23 @@
|
||||
from common.ComicInfo import ComicInfoUtils as ciUtils
|
||||
from common.ComicInfo import ComicInfo as ci
|
||||
from common.Comic import Comic
|
||||
from utils.NetUtils import htmlUtils
|
||||
|
||||
class DomainDown:
|
||||
@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
|
||||
ci.setPages(list_img)
|
||||
ci.writeComicInfoXML(Comic.getChapterName())
|
||||
ciUtils.comicChapterDownload(imgs_url,list_file_name)
|
||||
@@ -0,0 +1,44 @@
|
||||
from common.ComicInfo import ComicInfo as ci
|
||||
from common.ComicInfo import Comic
|
||||
from common.ComicInfo import ComicInfoUtils as ciUtils
|
||||
from common.Constant import pathStr
|
||||
from utils.FileUtils import imageUtils
|
||||
from utils.NetUtils import htmlUtils
|
||||
from utils.ComicUtils import ntfy
|
||||
|
||||
class DomainDown:
|
||||
@classmethod
|
||||
def comicChapterDownload(cls,chapter_url):
|
||||
str_xpath='//script[@id="__NEXT_DATA__"]/text()'
|
||||
str_exec="props.pageProps"
|
||||
book = htmlUtils.setXpathData(chapter_url,xpath=str_xpath,num=0,exec=str_exec)
|
||||
Comic.setComicName(book,"bookName")
|
||||
Comic.setChapterName(book,"chapterName")
|
||||
#alias = x.get("alias")
|
||||
Comic.setDep(book,"description")
|
||||
images = Comic.getValue(book,"images")
|
||||
chapter_api_url = ci.parseExec(book,"chapterAPIPath",start_add=pathStr.getBaseUrl(chapter_url))
|
||||
|
||||
if chapter_api_url != None:
|
||||
ntfy.sendMsg(f"chapterApiUrl= {chapter_api_url}",alert=False)
|
||||
data = htmlUtils.getJSON(chapter_api_url,update=True)
|
||||
if data != None:
|
||||
Comic.setChapterName(data,"chapter.name")
|
||||
images = Comic.getValue(data,"chapter.images")
|
||||
if len(images) == 0:
|
||||
ntfy.sendMsg(f"未获取到章节图像 comic_name={Comic.getComicName()} chapter={Comic.getChapterName()}")
|
||||
|
||||
count = 1
|
||||
list_img,list_file_name = [[],[]]
|
||||
for image in images:
|
||||
(image_src,scramble) = [image.get("src"),image.get("scramble")]
|
||||
count_image = "{:0>3d}".format(count)
|
||||
list_img.append(image_src)
|
||||
image_src_prefix = "."+str(image_src).split(".")[-1]
|
||||
if scramble:
|
||||
de_str = str(image_src).split("/")[-1].replace(image_src_prefix,"==")
|
||||
blocks_num = imageUtils.encodeImage(de_str)
|
||||
count_image = "scramble="+str(blocks_num)+"_"+count_image
|
||||
list_file_name.append(count_image+image_src_prefix)
|
||||
count+=1
|
||||
ciUtils.comicChapterDownload(list_img,list_file_name)
|
||||
Reference in new issue
Block a user