This commit is contained in:
cwx
2022-12-04 22:29:04 +08:00
commit 499cb29fa3
11 changed files with 628 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
import json,os
from utils.comic.ComicStr import comicStr
from utils.ComicUtils import comicUtils
from utils.FileUtils import fileUtils
class comicEntityRM:
@classmethod
def oneComic(cls,c_url):
#漫画名
title = comicUtils.xpathData(comicStr.title,
'//div[@class="col"]/h5/text()',url=c_url,num=0)
#别名
alias = comicUtils.xpathData(comicStr.alias,
'//span[contains(@class,"bookid_alias")]/text()',num=1)
icon = comicUtils.xpathData(comicStr.icon,
'//img[@class="img-thumbnail"]/@src')
author = comicUtils.xpathData(comicStr.author,
'//div[contains(@class,"bookid_bookInfo")]/p[1]/text()',num=1)
tags = comicUtils.xpathData(comicStr.tags,
'//div[contains(@class,"bookid_bookInfo")]/p[3]/b/text()')
action = comicUtils.xpathData(comicStr.action,
'//div[contains(@class,"bookid_bookInfo")]/p[2]/text()',num=1)
dep = comicUtils.xpathData(comicStr.dep,
'//div[contains(@class,"bookid_bookInfo")]/p[4]/text()',num=1)
update_date = comicUtils.xpathData(comicStr.last_update,
'//div[contains(@class,"bookid_bookInfo")]/p[5]/small/text()',num=1)
chapters = comicUtils.xpathData(comicStr.chapters,
'//div[contains(@class,"bookid_chapterBox")]//div[contains(@class,"bookid_chapter")]/a/text()')
chapter_href = comicUtils.xpathData(comicStr.chapter_href,
'//div[contains(@class,"bookid_chapterBox")]//div[contains(@class,"bookid_chapter")]/a/@href')
comicUtils.setComic(title,alias,icon,author,tags,action,dep,update_date,chapters,chapter_href)
#{'title': ['社區重建協會']}
#主页
#homepage = {comicStr.homepage : [c_url] }
#图片
#comicUtils.setComic(titles,homepage,icons,authors,deps,chapters, chapter_hrefs,last_update)
comicData = comicUtils.getComic()
print(comicData)
wait = input("数据暂停查看y/n")
if not wait == "y":
exit()
return comicData
'''
读取某章节下所有图片
'''
@classmethod
def comicChapter(cls,c_url,chapter):
xpath_str = '//img[contains(@class,"id_comicImage")]/@src'
not_eq = "/loading.jpg"
#章节下所有图片链接
list_img = comicUtils.xpathData(comicStr.list_img,
xpath_str,url=c_url,type=chapter,not_eq=not_eq)
print(list_img)
wait = input("暂停查看数据y/n")
if not wait == "y":
exit()
return list_img