fix
This commit is contained in:
1 parent
8276619657
commit
ec89cb7a01
2 files changed
+18
-14
No files matched your search
+18
-13
@@ -25,18 +25,23 @@ class htmlUtils:
|
|||||||
count = 1
|
count = 1
|
||||||
#数据为空则获取数据
|
#数据为空则获取数据
|
||||||
while url_text == None:
|
while url_text == None:
|
||||||
try:
|
if count <= 10:
|
||||||
print("请求地址:",curl)
|
try:
|
||||||
res = s.get(curl,stream=True, headers=cls.headers, timeout=50)
|
print("请求地址:",curl)
|
||||||
if type == "bytes":
|
res = s.get(curl,stream=True, headers=cls.headers, timeout=50)
|
||||||
url_text = res
|
if type == "bytes":
|
||||||
else:
|
url_text = res
|
||||||
url_text = html.fromstring(res.text)
|
else:
|
||||||
except:
|
url_text = html.fromstring(res.text)
|
||||||
print(f'Retry! 第{count}次')
|
except:
|
||||||
time.sleep(3)
|
print(f'Retry! 第{count}次')
|
||||||
traceback.print_exc()
|
time.sleep(3)
|
||||||
continue
|
traceback.print_exc()
|
||||||
|
count += 1
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
print(f"fail 请求失败:{curl}")
|
||||||
|
break
|
||||||
if type == "None":
|
if type == "None":
|
||||||
data = { curl : url_text}
|
data = { curl : url_text}
|
||||||
cls.url_data.update(data)
|
cls.url_data.update(data)
|
||||||
@@ -49,7 +54,7 @@ class htmlUtils:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def getJSON(cls,curl):
|
def getJSON(cls,curl):
|
||||||
count = 0
|
count = 0
|
||||||
while count <= 5:
|
while count < 5:
|
||||||
try:
|
try:
|
||||||
res = requests.get(curl, headers=cls.headers,timeout=50)
|
res = requests.get(curl, headers=cls.headers,timeout=50)
|
||||||
data_json = res.json()
|
data_json = res.json()
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ from utils.ImageUtils import imageUtils
|
|||||||
from utils.comic.ComicInfo import comicInfo
|
from utils.comic.ComicInfo import comicInfo
|
||||||
from utils.CBZUtils import CBZUtils
|
from utils.CBZUtils import CBZUtils
|
||||||
from utils.downloader import download_images
|
from utils.downloader import download_images
|
||||||
from utils.entity.BaseComicEntity import baseComic
|
|
||||||
|
|
||||||
class comicEntity:
|
class comicEntity:
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user