mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
fix search_image
This commit is contained in:
parent
947166e793
commit
0736533389
@ -245,8 +245,10 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__
|
||||
|
||||
### 2022/6/13
|
||||
|
||||
* 色图等提供修改md5方法
|
||||
* webui中token.json文件写入补充
|
||||
* Windows 重启适配 [@pull/804](https://github.com/HibiKier/zhenxun_bot/pull/804)
|
||||
* 色图等提供修改md5方法 [@pull/800](https://github.com/HibiKier/zhenxun_bot/pull/800)
|
||||
* webui中token.json文件写入补充 [@pull/798](https://github.com/HibiKier/zhenxun_bot/pull/798)
|
||||
* 修复识图某些图片可能会出错
|
||||
|
||||
### 2022/6/11
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
from services import logger
|
||||
from utils.http_utils import AsyncHttpx
|
||||
from configs.config import Config
|
||||
from configs.path_config import TEMP_PATH
|
||||
@ -39,12 +40,18 @@ async def get_saucenao_image(url: str) -> Union[str, List[str]]:
|
||||
):
|
||||
msg_list.append(image(TEMP_PATH / f"saucenao_search_{index}.jpg"))
|
||||
for info in data:
|
||||
similarity = info["header"]["similarity"]
|
||||
tmp = f"相似度:{similarity}%\n"
|
||||
for x in info["data"].keys():
|
||||
if x != "ext_urls":
|
||||
tmp += f"{x}:{info['data'][x]}\n"
|
||||
if "source" not in info["data"].keys():
|
||||
tmp += f'source:{info["data"]["ext_urls"][0]}\n'
|
||||
msg_list.append(tmp[:-1])
|
||||
try:
|
||||
similarity = info["header"]["similarity"]
|
||||
tmp = f"相似度:{similarity}%\n"
|
||||
for x in info["data"].keys():
|
||||
if x != "ext_urls":
|
||||
tmp += f"{x}:{info['data'][x]}\n"
|
||||
try:
|
||||
if "source" not in info["data"].keys():
|
||||
tmp += f'source:{info["data"]["ext_urls"][0]}\n'
|
||||
except KeyError:
|
||||
tmp += f'source:{info["header"]["thumbnail"]}\n'
|
||||
msg_list.append(tmp[:-1])
|
||||
except Exception as e:
|
||||
logger.warning(f"识图获取图片信息发生错误 {type(e)}:{e}")
|
||||
return msg_list
|
||||
|
||||
Loading…
Reference in New Issue
Block a user