fix
This commit is contained in:
+15
-15
@@ -1,32 +1,37 @@
|
||||
import json,os,time,random,shutil
|
||||
from utils.ComicUtils import comicUtils
|
||||
from utils.NetUtils import netUtils
|
||||
from utils.HtmlUtils import htmlUtils
|
||||
from utils.ImageUtils import imageUtils
|
||||
from utils.comic.ComicInfo import comicInfo
|
||||
from utils.CBZUtils import CBZUtils
|
||||
from utils.downloader import download_images
|
||||
from utils.entity.BaseComicEntity import baseComic
|
||||
|
||||
class comicEntity:
|
||||
|
||||
|
||||
@classmethod
|
||||
def downladsComcis(cls,url):
|
||||
#漫画名
|
||||
def baseComicData(cls,url):
|
||||
data = htmlUtils.xpathData('//script[@id="__NEXT_DATA__"]/text()',url=url)
|
||||
# #
|
||||
data = json.loads(data[0])
|
||||
data = data.get("props")
|
||||
x = data.get("pageProps")
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def downladsComcis(cls,url):
|
||||
#漫画名
|
||||
x = cls.baseComicData(url)
|
||||
books = x.get("books")
|
||||
len_books = len(books)
|
||||
baseUrl = comicInfo.getBaseUrl(url)
|
||||
for x in range(0, len_books):
|
||||
book = books[x]
|
||||
#https://rm01.xyz/books/052426c3-ec7d-4035-b614-3c9290ee625b
|
||||
book_id = book.get("id")
|
||||
book_name = book.get("name")
|
||||
comicHref = baseUrl+"/books/"+book_id
|
||||
updatedAt = book.get("updatedAt")
|
||||
comicHref = baseUrl+"/books/"+book_id
|
||||
random_int = random.uniform(5,20)
|
||||
wait = print(f"{random_int}秒后开始下载 漫画:{book_name}")
|
||||
print(f"{random_int}秒后开始下载 漫画:{book_name}")
|
||||
time.sleep(random_int)
|
||||
cls.oneComic(comicHref, random.uniform(0,3))
|
||||
|
||||
@@ -131,12 +136,7 @@ class comicEntity:
|
||||
|
||||
@classmethod
|
||||
def comicChapterDownload(cls,chapter_url):
|
||||
#漫画名
|
||||
data = htmlUtils.xpathData('//script[@id="__NEXT_DATA__"]/text()',url=chapter_url)
|
||||
# #
|
||||
data = json.loads(data[0])
|
||||
data = data.get("props")
|
||||
x = data.get("pageProps")
|
||||
x = cls.baseComicData(chapter_url)
|
||||
bookName = x.get("bookName")
|
||||
chapterName = x.get("chapterName")
|
||||
#fileUtils.saveConfComicChapterInfo(chapterName,x,bookName)
|
||||
@@ -156,7 +156,7 @@ class comicEntity:
|
||||
comicInfo.writeComicInfoXML(chapterName)
|
||||
|
||||
if not chapterAPIPath == None:
|
||||
base_url = comicUtils.getBaseUrl(chapter_url)
|
||||
base_url = comicInfo.getBaseUrl(chapter_url)
|
||||
chapterAPIUrl = base_url+chapterAPIPath
|
||||
data = htmlUtils.getJSON(chapterAPIUrl)
|
||||
data = data.get("chapter")
|
||||
|
||||
Reference in New Issue
Block a user