This commit is contained in:
cwx committed 2023-04-05 00:12:18 +08:00
1 parent 80a544672a
commit 0c126aab22
10 files changed
+246 -233

No files matched your search

+4 -3
View File
@@ -2,6 +2,7 @@ import json
from utils.NetUtils import htmlUtils
from common.ComicInfo import ComicInfoUtils as ciUtils
from common.BaseComicEntity import baseComic
from common.Constant import pathStr
class comicEntity:
@classmethod
@@ -18,16 +19,16 @@ class comicEntity:
x = cls.baseComicData(url)
books = x.get("books")
len_books = len(books)
base_url = ciUtils.getBaseUrl(url)
base_url = pathStr.getBaseUrl(url)
for x in range(0, len_books):
book = books[x]
book_id = book.get("id")
book_name = book.get("name")
updated = book.get("updatedAt")
comic_href = base_url+"/books/"+book_id
href = baseComic.downladsComcis(book_name=book_name,comic_href=comic_href,updated=updated)
href = baseComic.updateOneComic(book_name=book_name,comic_href=comic_href,updated=updated)
cls.oneComic(href)
ciUtils.updateComicDate()
ciUtils.updateLastDate()
@classmethod
def oneComic(cls,c_url,sleep=None):
+1 -6
View File
@@ -10,14 +10,9 @@ class comicEntity:
str_xpath='//script[@id="__NEXT_DATA__"]/text()'
str_exec="props.pageProps.books"
books = htmlUtils.setXpathData(url,xpath=str_xpath,num=0,exec=str_exec)
#comic_names = htmlUtils.setXpathData(url,xpath=str_xpath,num=0,exec=str_exec,result_type="list",type="name")
#chapter_links = htmlUtils.setXpathData(url,xpath=str_xpath,num=0,exec=str_exec,result_type="list",type="id"
# ,start_add=pathStr.getBaseUrl(url)+"/books/")
#update_at= htmlUtils.setXpathData(url,xpath=str_xpath,num=0,exec=str_exec,result_type="list",type="updateAt")
#ciUtils.setListComicsLinksUpdateAt(comic_names,chapter_links,update_at)
ListComic.setListComicName(books,"name")
ListComic.setListComicChapterLink(books,"id",start_add=pathStr.getBaseUrl(url)+"/books/")
ListComic.setListComicUpdateAt(books,"updateAt")
ListComic.setListComicUpdateAt(books,"updatedAt")
return baseComic.updateComics(chapters_xpath='//div[contains(@class,"bookid_chapterBox")]//div[contains(@class,"bookid_chapter")]/a/text()')
@classmethod