update
This commit is contained in:
1 parent
eaf15969f0
commit
25be464102
8 files changed
+119
-121
No files matched your search
+16
-25
@@ -5,33 +5,24 @@ from utils.downloader import download_images
|
||||
from utils.base.BaseComicEntity import baseComic
|
||||
|
||||
class comicEntity:
|
||||
@classmethod
|
||||
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")
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def downladsComcis(cls,url):
|
||||
#漫画名
|
||||
x = cls.baseComicData(url,True)
|
||||
books = x.get("books")
|
||||
len_books = len(books)
|
||||
base_url = comicInfo.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
|
||||
comicInfo.setUpdateAt(updated)
|
||||
comicInfo.setComicName(book_name)
|
||||
cls.oneComic(baseComic.comics(book_name=book_name,comic_href=comic_href,updated=updated),date=updated)
|
||||
|
||||
@classmethod
|
||||
def oneComic(cls,c_url,sleep=None,date=None):
|
||||
def booksJson(cls,url,update=False):
|
||||
data = htmlUtils.xpathData('//script[@id="__NEXT_DATA__"]/text()',url=url,update=update)
|
||||
return json.loads(data[0]).get("props").get("pageProps").get("books")
|
||||
|
||||
@classmethod
|
||||
def downladsComcis(cls,url):
|
||||
#漫画名
|
||||
books = cls.booksJson(url,True)
|
||||
for x in range(0, len(books)):
|
||||
comicInfo.setComicInfo(comicname=books[x].get("name"),
|
||||
current_chapter_img=comicInfo.getBaseUrl(url)+"/books/"+books[x].get("id"),
|
||||
update_at=books[x].get("updatedAt"))
|
||||
cls.oneComic(baseComic.updateComics())
|
||||
|
||||
@classmethod
|
||||
def oneComic(cls,c_url,sleep=None,date=comicInfo.getUpdateAt()):
|
||||
if c_url == None: return None
|
||||
#漫画名
|
||||
title = htmlUtils.xpathData('//div[@class="col"]/h5/text()',url=c_url,num=0,update=True)
|
||||
|
||||
Reference in new issue
Block a user