Closed Yangleis closed 1 year ago
请你更新一下 picimagesearch ,之后重启机器人再试试。
picimagesearch 更新至 3.7.6 ,重复数次尝试,都是报了了另一个错误。(日志在末尾)
补充下我的配置情况: 只配置了SAUCENAO_API_KEY、EXHENTAI_COOKIES两项,其他未配置。
顺带提一下,不知是我QQ号被风控还是QQ对这张图特别敏感,每次搜索完我想再发这张图就发不出去了,每次搜索我都是重新截图的,但基本都是截的全图少一点点像素。
错误日志:
01-04 15:29:14 [ERROR] YetAnotherPicSearch | 该图 [https://gchat.qpic.cn/gchatpic_new/0/0-0-FF919626FF9416CFD6673B6CAC9A559F/0] 搜图失败
Traceback (most recent call last):
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/bin/nb", line 8, in <module>
sys.exit(main())
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/nb_cli/commands/main.py", line 30, in run
run_bot(file, app)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/nb_cli/handlers/deploy.py", line 25, in run_bot
nonebot.run(app=f"{module_name}:{app}")
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/nonebot/__init__.py", line 273, in run
get_driver().run(*args, **kwargs)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 172, in run
uvicorn.run(
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/uvicorn/main.py", line 569, in run
server.run()
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/uvicorn/server.py", line 60, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/nonebot/message.py", line 142, in _check_matcher
await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/nonebot/message.py", line 188, in _run_matcher
await matcher.run(bot, event, state, stack, dependency_cache)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 727, in run
await self.simple_run(bot, event, state, stack, dependency_cache)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 702, in simple_r
await handler(
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 108, in __call__
return await cast(Callable[..., Awaitable[R]], self.call)(**values)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/YetAnotherPicSearch/__init__.py", line 258, in handle_image
await image_search(url, md5, mode, purge, _cache, client),
> File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/YetAnotherPicSearch/__init__.py", line 110, in image_search
async for attempt in AsyncRetrying(
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/tenacity/_asyncio.py", line 69, in __anext__
do = self.iter(retry_state=self._retry_state)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/tenacity/__init__.py", line 362, in iter
raise retry_exc.reraise()
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/tenacity/__init__.py", line 195, in reraise
raise self.last_attempt.result()
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/YetAnotherPicSearch/__init__.py", line 123, in image_search
result = await saucenao_search(url, mode, client, hide_img)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/YetAnotherPicSearch/saucenao.py", line 107, in saucenao_sea
final_res.extend(await ehentai_title_search(selected_res.title, hide_img))
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/YetAnotherPicSearch/ehentai.py", line 69, in ehentai_title_
return await search_result_filter(res, hide_img)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/YetAnotherPicSearch/ehentai.py", line 122, in search_result
thumbnail = await handle_img(
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/YetAnotherPicSearch/utils.py", line 38, in handle_img
if image_bytes := await get_image_bytes_by_url(url, cookies):
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/YetAnotherPicSearch/utils.py", line 26, in get_image_bytes_
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/aiohttp/client.py", line 357, in _build_url
url = URL(str_or_url)
File "/home/qqbot/.cache/pypoetry/virtualenvs/nonebot-C1Dwp4J_-py3.10/lib/python3.10/site-packages/yarl/_url.py", line 154, in __new__
raise TypeError("Constructor parameter should be str")
TypeError: Constructor parameter should be str
01-04 15:29:15 [INFO] nonebot | Matcher(type='message', module=YetAnotherPicSearch) running complete
麻烦你往本地依赖文件里的 PicImageSearch/model/ehentai.py 第 16 行后面添加下面两行代码:
from loguru import logger
logger.info(data)
然后重启机器人,再试着搜索那张图,把这里额外打印的日志贴出来。 主要是我不知道你那边获取到的 EH 网页结构为什么不太一样,所以需要看看。
日志内容太多,无法直接放回复里,所以只能上传文件,这只是一次搜索的日志。 nonebot.log
我知道为什么了,因为你用的网页布局确实不一样。。 Minimal / Minimal+ / Compact / Extended / Thumbnail ,前三个差别不是很大,后两个和前面的差别比较大。 等我再改改 PicImageSearch 的解析逻辑。
看来确实是这个原因,我把布局改为 Compact 就正常了。
改好了,你可以用 pip install -U PicImageSearch
来更新依赖。
YetAnotherPicSearch 、 go-cqhttp 、 nonebot 、 Python 版本及操作系统
YetAnotherPicSearch 1.7.8 go-cqhttp v1.0.0-rc3 nonebot v2.0.0rc2 Python 3.10 Ubuntu 22.04.1 LTS x86_64
列出安装的 Python 包
相关依赖已经检查过,和pyproject.toml文件内版本一致。
如何复现
用附件图片直接搜索,应该能稳定触发异常。(至少在我这里是)
期望行为
No response
实际行为
出错时的聊天截图: 出错时的日志:
出现问题的图片: