提交 78665780 编写于 作者: W wizardforcel

将图像处理逻辑引至 API 类

上级 22d3ec53
......@@ -45,7 +45,7 @@ def load_api_by_prefix(s):
def fetch_meta(s):
url = api.meta2real(s)
if not url: return None
full_meta = image_download(url)
full_meta = api.image_download(url)
if not full_meta: return None
meta_dict = json.loads(encoder.decode(full_meta).decode("utf-8"))
return meta_dict
......@@ -171,7 +171,7 @@ def tr_download(i, block_dict, f, offset):
url = block_dict['url']
for j in range(10):
if not succ: break
block = image_download(url)
block = api.image_download(url)
if not block:
log(f"分块{i + 1}/{nblocks}{j + 1}次下载失败")
if j == 9: succ = False
......
......@@ -17,7 +17,7 @@ class BaseApi:
def get_user_info(self, fmt=True):
return '获取用户信息功能尚未实现'
def image_download(url):
def image_download(self, url):
return image_download(url)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册