fix
This commit is contained in:
1 parent
0c9c82e375
commit
906184f8c6
2 files changed
+13
-4
No files matched your search
@@ -1,8 +1,13 @@
|
|||||||
|
import os
|
||||||
from utils.entity.RouMan import comicEntity
|
from utils.entity.RouMan import comicEntity
|
||||||
|
#from utils.entity.JMTI import comicEntity
|
||||||
|
|
||||||
def comics():
|
def comics():
|
||||||
for x in range(0,50):
|
for x in range(0,50):
|
||||||
comicEntity.downladsComcis("https://rm01.xyz/books?&page="+str(x))
|
comicEntity.downladsComcis("https://rm01.xyz/books?&page="+str(x))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
comics()
|
#comics()
|
||||||
|
# os.environ["http_proxy"] = "http://127.0.0.1:7890"
|
||||||
|
# os.environ["https_proxy"] = "http://127.0.0.1:7890"
|
||||||
|
# comicEntity.oneComic("https://18comic.vip/album/358870/")
|
||||||
+7
-3
@@ -51,7 +51,8 @@ class htmlUtils:
|
|||||||
print()
|
print()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getHTML(cls, curl,type=None):
|
def getHTML(cls, curl,type=None,update=False):
|
||||||
|
url_text = None
|
||||||
retries = Retry(total=1,
|
retries = Retry(total=1,
|
||||||
backoff_factor=0.1,
|
backoff_factor=0.1,
|
||||||
status_forcelist=[ 500, 502, 503, 504 ])
|
status_forcelist=[ 500, 502, 503, 504 ])
|
||||||
@@ -60,7 +61,8 @@ class htmlUtils:
|
|||||||
s.mount('https://', HTTPAdapter(max_retries=retries))
|
s.mount('https://', HTTPAdapter(max_retries=retries))
|
||||||
count = 1
|
count = 1
|
||||||
#数据为空则获取数据
|
#数据为空则获取数据
|
||||||
url_text = cls.getPathSaveHtml(curl,"read")
|
if not update:
|
||||||
|
url_text = cls.getPathSaveHtml(curl,"read")
|
||||||
if url_text != None:
|
if url_text != None:
|
||||||
return html.fromstring(url_text)
|
return html.fromstring(url_text)
|
||||||
while url_text == None:
|
while url_text == None:
|
||||||
@@ -119,7 +121,9 @@ class htmlUtils:
|
|||||||
except:
|
except:
|
||||||
ntfy.sendMsg(f"html_cache更新失败 {html_cache_path}")
|
ntfy.sendMsg(f"html_cache更新失败 {html_cache_path}")
|
||||||
#获取html实体数据
|
#获取html实体数据
|
||||||
et = cls.getHTML(url)
|
et = cls.getHTML(url,update=update)
|
||||||
|
if et == None:
|
||||||
|
return None
|
||||||
#比对数据
|
#比对数据
|
||||||
count = 1
|
count = 1
|
||||||
xpaths = et.xpath(c_xpath)
|
xpaths = et.xpath(c_xpath)
|
||||||
|
|||||||
Reference in new issue
Block a user