fix
This commit is contained in:
parent
fd728724c1
commit
934d753778
@ -51,7 +51,7 @@ class htmlUtils:
|
|||||||
print()
|
print()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getHTML(cls, curl,type=None):
|
def getHTML(cls, curl,type=None,update=False):
|
||||||
url_text = None
|
url_text = None
|
||||||
retries = Retry(total=1,
|
retries = Retry(total=1,
|
||||||
backoff_factor=0.1,
|
backoff_factor=0.1,
|
||||||
@ -65,9 +65,7 @@ class htmlUtils:
|
|||||||
url_text = cls.getPathSaveHtml(curl,"read")
|
url_text = cls.getPathSaveHtml(curl,"read")
|
||||||
except:
|
except:
|
||||||
url_text = None
|
url_text = None
|
||||||
if url_text != None:
|
while url_text == None or update:
|
||||||
return html.fromstring(url_text)
|
|
||||||
while url_text == None:
|
|
||||||
if count <= 5:
|
if count <= 5:
|
||||||
try:
|
try:
|
||||||
print(f"请求地址:{curl}")
|
print(f"请求地址:{curl}")
|
||||||
@ -97,15 +95,15 @@ class htmlUtils:
|
|||||||
ntfy.sendMsg(f"fail 请求失败:{curl}")
|
ntfy.sendMsg(f"fail 请求失败:{curl}")
|
||||||
exit()
|
exit()
|
||||||
break
|
break
|
||||||
return url_text
|
return html.fromstring(url_text)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getBytes(cls, url):
|
def getBytes(cls, url):
|
||||||
return cls.getHTML(url,type="bytes")
|
return cls.getHTML(url,type="bytes")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getJSON(cls,url):
|
def getJSON(cls,url,update=False):
|
||||||
return cls.getHTML(url,type="json")
|
return cls.getHTML(url,type="json",update=update)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def xpathData(cls,c_xpath,url=None,num=None,not_eq=None,update=False):
|
def xpathData(cls,c_xpath,url=None,num=None,not_eq=None,update=False):
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class comicCommon:
|
|||||||
base_url = comicInfo.getBaseUrl(chapter_url)
|
base_url = comicInfo.getBaseUrl(chapter_url)
|
||||||
chapter_api_url = base_url+chapter_api_path
|
chapter_api_url = base_url+chapter_api_path
|
||||||
ntfy.sendMsg(f"chapterApiUrl= {chapter_api_url}",alert=False)
|
ntfy.sendMsg(f"chapterApiUrl= {chapter_api_url}",alert=False)
|
||||||
data = htmlUtils.getJSON(chapter_api_url)
|
data = htmlUtils.getJSON(chapter_api_url,update=True)
|
||||||
if data != None:
|
if data != None:
|
||||||
data = data.get("chapter")
|
data = data.get("chapter")
|
||||||
chapter_name = data.get("name")
|
chapter_name = data.get("name")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user