diff --git a/utils/HtmlUtils.py b/utils/HtmlUtils.py index f02fb24..759ee5a 100644 --- a/utils/HtmlUtils.py +++ b/utils/HtmlUtils.py @@ -51,7 +51,7 @@ class htmlUtils: print() @classmethod - def getHTML(cls, curl,type=None): + def getHTML(cls, curl,type=None,update=False): url_text = None retries = Retry(total=1, backoff_factor=0.1, @@ -65,9 +65,7 @@ class htmlUtils: url_text = cls.getPathSaveHtml(curl,"read") except: url_text = None - if url_text != None: - return html.fromstring(url_text) - while url_text == None: + while url_text == None or update: if count <= 5: try: print(f"请求地址:{curl}") @@ -97,15 +95,15 @@ class htmlUtils: ntfy.sendMsg(f"fail 请求失败:{curl}") exit() break - return url_text + return html.fromstring(url_text) @classmethod def getBytes(cls, url): return cls.getHTML(url,type="bytes") @classmethod - def getJSON(cls,url): - return cls.getHTML(url,type="json") + def getJSON(cls,url,update=False): + return cls.getHTML(url,type="json",update=update) @classmethod def xpathData(cls,c_xpath,url=None,num=None,not_eq=None,update=False): diff --git a/utils/entity/down/RouMan.py b/utils/entity/down/RouMan.py index 06dd995..a30c5e8 100644 --- a/utils/entity/down/RouMan.py +++ b/utils/entity/down/RouMan.py @@ -34,7 +34,7 @@ class comicCommon: base_url = comicInfo.getBaseUrl(chapter_url) chapter_api_url = base_url+chapter_api_path 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: data = data.get("chapter") chapter_name = data.get("name")