fix
This commit is contained in:
1 parent
fd8d056105
commit
9ec2963a61
5 files changed
+80
-13
No files matched your search
+12
-6
@@ -13,8 +13,8 @@ class comicEntity:
|
||||
|
||||
|
||||
@classmethod
|
||||
def baseComicData(cls,url):
|
||||
data = htmlUtils.xpathData('//script[@id="__NEXT_DATA__"]/text()',url=url)
|
||||
def baseComicData(cls,url,update=False):
|
||||
data = htmlUtils.xpathData('//script[@id="__NEXT_DATA__"]/text()',url=url,update=update)
|
||||
data = json.loads(data[0])
|
||||
data = data.get("props")
|
||||
x = data.get("pageProps")
|
||||
@@ -23,7 +23,7 @@ class comicEntity:
|
||||
@classmethod
|
||||
def downladsComcis(cls,url):
|
||||
#漫画名
|
||||
x = cls.baseComicData(url)
|
||||
x = cls.baseComicData(url,update=True)
|
||||
books = x.get("books")
|
||||
len_books = len(books)
|
||||
base_url = comicInfo.getBaseUrl(url)
|
||||
@@ -32,6 +32,8 @@ class comicEntity:
|
||||
book_id = book.get("id")
|
||||
book_name = book.get("name")
|
||||
updated = book.get("updatedAt")
|
||||
comicInfo.setComicName(book_name)
|
||||
comicInfo.setUpdateAt(updated)
|
||||
comic_href = base_url+"/books/"+book_id
|
||||
random_int = random.randint(5,20)
|
||||
comicInfo.setComicName(book_name)
|
||||
@@ -41,8 +43,12 @@ class comicEntity:
|
||||
time.sleep(random_int)
|
||||
else:
|
||||
ntfy.sendMsg(f"已存在 漫画:{book_name}")
|
||||
cls.oneComic(comic_href, random.uniform(0,3))
|
||||
|
||||
if comicInfo.isUpdateComic():
|
||||
cls.oneComic(comic_href, random.uniform(0,3))
|
||||
comicInfo.updateComicDate()
|
||||
else:
|
||||
ntfy.sendMsg(f"{book_name} 已是最新")
|
||||
|
||||
print(books)
|
||||
#for comicHref in comicsHref:
|
||||
# cls.oneComic(comicHref,random.uniform(10,20))
|
||||
@@ -50,7 +56,7 @@ class comicEntity:
|
||||
@classmethod
|
||||
def oneComic(cls,c_url,sleep=None):
|
||||
#漫画名
|
||||
title = htmlUtils.xpathData('//div[@class="col"]/h5/text()',url=c_url,num=0)
|
||||
title = htmlUtils.xpathData('//div[@class="col"]/h5/text()',url=c_url,num=0,update=True)
|
||||
#别名
|
||||
alias = htmlUtils.xpathData('//span[contains(@class,"bookid_alias")]/text()',num=1)
|
||||
icon = htmlUtils.xpathData('//img[@class="img-thumbnail"]/@src',num=0)
|
||||
|
||||
Reference in new issue
Block a user