fix
This commit is contained in:
1 parent
9c9ce77e71
commit
45ac0732fd
2 files changed
+5
-13
No files matched your search
@@ -3,7 +3,7 @@ from utils.comic.ComicInfo import comicInfo
|
|||||||
import os,shutil
|
import os,shutil
|
||||||
|
|
||||||
def comics():
|
def comics():
|
||||||
for x in range(0,20):
|
for x in range(0,5):
|
||||||
comicEntity.downladsComcis("https://rm01.xyz/books?&page="+str(x))
|
comicEntity.downladsComcis("https://rm01.xyz/books?&page="+str(x))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
+4
-12
@@ -31,7 +31,9 @@ class htmlUtils:
|
|||||||
print(f"请求地址:{curl}")
|
print(f"请求地址:{curl}")
|
||||||
res = s.get(curl,stream=True, headers=cls.headers, timeout=50)
|
res = s.get(curl,stream=True, headers=cls.headers, timeout=50)
|
||||||
if type == "bytes":
|
if type == "bytes":
|
||||||
url_text = res
|
return res
|
||||||
|
if type == "json":
|
||||||
|
return res.json()
|
||||||
else:
|
else:
|
||||||
url_text = html.fromstring(res.text)
|
url_text = html.fromstring(res.text)
|
||||||
except:
|
except:
|
||||||
@@ -54,17 +56,7 @@ class htmlUtils:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getJSON(cls,curl):
|
def getJSON(cls,curl):
|
||||||
count = 0
|
cls.getHTML(curl, type="json")
|
||||||
while count < 5:
|
|
||||||
try:
|
|
||||||
res = requests.get(curl, headers=cls.headers,timeout=50)
|
|
||||||
data_json = res.json()
|
|
||||||
return data_json
|
|
||||||
except:
|
|
||||||
ntfy.sendMsg(f"请求失败,重试中... {curl}")
|
|
||||||
count += 1
|
|
||||||
time.sleep(1)
|
|
||||||
cls.getJSON(curl)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def xpathData(cls,c_xpath,url=None,num=None,not_eq=None):
|
def xpathData(cls,c_xpath,url=None,num=None,not_eq=None):
|
||||||
|
|||||||
Reference in new issue
Block a user