Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用Ascii2D搜索一直提示暂时无法使用 #139

Closed
PROBEFISH opened this issue Sep 7, 2024 · 13 comments
Closed

使用Ascii2D搜索一直提示暂时无法使用 #139

PROBEFISH opened this issue Sep 7, 2024 · 13 comments
Labels
question Further information is requested

Comments

@PROBEFISH
Copy link

YetAnotherPicSearch 、 PicImageSearch 、 go-cqhttp 、 nonebot 、 Python 版本及操作系统

YetAnotherPicSearch 2.0.1.post2
PicImageSearch v3.10.8

列出安装的 Python 包

No response

如何复现

搜图复现

期望行为

No response

实际行为

代理设置没有问题,谷歌和SauceNAO搜索都能正常使用,也没有任何报错,直接访问https://ascii2d.net/也没有问题
3)( {QO9 XJO UF8U(6C1NW
我尝试写了个测试连通性的代码也是能成功访问的

import requests

def test_connectivity_and_search(url, image_url=None, image_file=None):
    headers = {
            "Referer": "https://ascii2d.net/",
            "User-Agent": "Mozilla/5.0 (Linux; Android 6.0.1; SM-G920V Build/MMB29K) "\
                  "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36"
        }
    proxies = {
        "http": "http://127.0.0.1:7890",
        "https": "http://127.0.0.1:7890"
    }
    try:
        response = requests.get(url, headers=headers,proxies=proxies)
        if response.status_code == 200:
            print(f"成功访问 {url},状态码:{response.status_code}")
        else:
            print(f"访问 {url} 失败,状态码:{response.status_code}")
@PROBEFISH PROBEFISH added the bug Something isn't working label Sep 7, 2024
@NekoAria
Copy link
Collaborator

NekoAria commented Sep 10, 2024

你的状态码难道不是 403?那你打印下 response 的内容看看。

否则只能是用镜像站的办法解决,配置 base_url:
https://github.com/kitUIN/PicImageSearch/blob/f4058120de91bf92a17236365417e571a0e191c1/demo/cn/demo_ascii2d.py#L11-L21

@XieXiLin2 XieXiLin2 added question Further information is requested and removed bug Something isn't working labels Sep 10, 2024
@PROBEFISH
Copy link
Author

成功访问 https://ascii2d.net,状态码:200
我加了个直接提交搜索的部分也是能正常触发并且返回东西的

def search_by_url(image_url):
    proxies = {
        "http": "http://127.0.0.1:7890",
        "https": "http://127.0.0.1:7890"
    }
    search_url = "https://ascii2d.net/search/uri"
    headers = {
            "Referer": "https://ascii2d.net/",
            "User-Agent": "Mozilla/5.0 (Linux; Android 6.0.1; SM-G920V Build/MMB29K) "\
                  "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36"
        }
    try:
        response = requests.post(search_url, data={"uri": image_url}, headers=headers,proxies=proxies)
        if response.status_code == 200:
            print("通过图片 URL 搜索成功:")
            print(response.text)
        else:
            print(f"图片 URL 搜索失败,状态码:{response.status_code}")

@NekoAria
Copy link
Collaborator

那你往这行下面加日志打印看看:

打印 color_res.origin

@PROBEFISH
Copy link
Author

image
出来的是这个被拦截了

@NekoAria
Copy link
Collaborator

那不还是被拦截了,无解。
只能是我上面说的,用镜像站解决。

@PROBEFISH
Copy link
Author

佬 有没有什么教程或者说明之类的东西
我完全没整过镜像站,所以不清楚应该要做什么

@NekoAria
Copy link
Collaborator

@PROBEFISH
Copy link
Author

可以用了 谢谢大佬

@KiriSuoh
Copy link

我未配置镜像站,也有相同问题。

QQ截图20240916143649
就连这种完整彩图都无法搜到了,草

最好用的感觉是ascii2d特征检索(搜含文字或只有一部分图片时好用),koishi的koishi-plugin-image-search能正常用,
另一个nb2搜图插件imgexploration的google的cookie对ip要求高还是什么原因也难以配置成功,估计他ascii2d也是差不多问题,经常只有yandex的返回。我想说的是,感觉最近一年sauceNao和google搜图功能差劲了很多,没有ascii2d真不行。

@NekoAria
Copy link
Collaborator

目前最轻量级的解决办法就是用 Cloudflare Workers 弄个网页反向代理了。
然后把 https://[workers 域名]/https://ascii2d.net 设置为 base_url

我稍微看了下 koishi-plugin-image-search 的源码,它主要也就是用了 postman UA ,事实上并不能绕过 Cloudflare 。
cq-picsearcher-bot 则是建议通过可配置的 Puppeteer 来绕过。

@NekoAria NekoAria pinned this issue Sep 16, 2024
@KiriSuoh
Copy link

感谢回复!我这次更新了插件并按教程配置了workers,但我的浏览器能访问中转的地址,插件却访问不了
实现端是llonebot
QQ截图20240917054549

QQ截图20240917053844

0A6DBA4FB3AAE354E2E7111C63411814

09-17 05:32:07 [SUCCESS] nonebot | OneBot V11 2040209149 | [message_sent]: {'time': 1726522326, 'self_id': 2040209149, 'post_type': 'message_sent', 'user_id': 2040209149, 'sub_type': 'friend', 'message_seq': -2147475362, 'raw_message': '[CQ:json,data={"app":"com.tencent.multimsg","config":{"autosize":1,"forward":1,"round":1,"type":"normal","width":300},"desc":"[聊天记录]","extra":"{\\"filename\\":\\"MultiMsg\\",\\"tsum\\":2}\\n","meta":{"detail":{"news":[{"text":"斗魂骇客: SauceNAO (50.67%)\\n[图片]\\nRecovery\\n作者:[OokamiLokester](http://ookam"},{"text":"斗魂骇客: 相似度 50.67% 过低,自动使用 Ascii2D 进行搜索"}],"resid":"","source":"斗魂骇客的聊天记录","summary":"查看2条转发消息","uniseq":"MultiMsg"}},"prompt":"[聊天记录]","ver":"0.0.0.5","view":"contact"}\n]', 'message_id': -2147475362, 'font': 14, 'message_type': 'private', 'message_format': 'array', 'target_id': 1925477085, 'message': [{'data': {'data': '{"app":"com.tencent.multimsg","config":{"autosize":1,"forward":1,"round":1,"type":"normal","width":300},"desc":"[聊天记录]","extra":"{\\"filename\\":\\"MultiMsg\\",\\"tsum\\":2}\\n","meta":{"detail":{"news":[{"text":" 斗魂骇客: SauceNAO (50.67%)\\n[图片]\\nRecovery\\n作者:[OokamiLokester](http://ookam"},{"text":"斗魂骇客: 相似度 50.67% 过低,自动使用 Ascii2D 进行搜索"}],"resid":"","source":"斗魂骇客的聊天记录","summary":"查看2条转发消息","uniseq":"MultiMsg"}},"prompt":"[聊天记录]","ver":"0.0.0.5","view":"contact"}\n'}, 'type': 'json'}], 'real_id': -2147475362, 'sender': {'user_id': 2040209149, 'nickname': '斗魂骇客', 'card': ''}}
09-17 05:32:21 [ERROR] YetAnotherPicSearch | Error occurred
Traceback (most recent call last):
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_transports\default.py", line 69, in map_httpcore_exceptions
    yield
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_transports\default.py", line 373, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpcore\_async\connection_pool.py", line 216, in handle_async_request
    raise exc from None
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpcore\_async\connection_pool.py", line 196, in handle_async_request
    response = await connection.handle_async_request(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpcore\_async\http_proxy.py", line 317, in handle_async_request
    stream = await stream.start_tls(**kwargs)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpcore\_async\http11.py", line 383, in start_tls
    return await self._stream.start_tls(ssl_context, server_hostname, timeout)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpcore\_backends\anyio.py", line 68, in start_tls
    with map_exceptions(exc_map):
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 17, in <module>
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\__init__.py", line 335, in run
    get_driver().run(*args, **kwargs)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run
    uvicorn.run(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\uvicorn\main.py", line 577, in run
    server.run()
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\uvicorn\server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\windows_events.py", line 322, in run_forever
    super().run_forever()
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 641, in run_forever
    self._run_once()
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 1987, in _run_once
    handle._run()
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\internal\matcher\matcher.py", line 850, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\internal\matcher\matcher.py", line 825, in simple_run
    await handler(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\dependencies\__init__.py", line 94, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\__main__.py", line 317, in search_handler
    async with fail_with_msg(
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 231, in __aexit__
    await self.gen.athrow(value)
> File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\__main__.py", line 150, in fail_with_msg
    yield
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\__main__.py", line 321, in search_handler
    await handle_single_image(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\__main__.py", line 291, in handle_single_image
    res = await func(file, client, mode)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\utils.py", line 231, in wrapper
    result = await func(*args, **kwargs)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\data_source\ascii2d.py", line 33, in ascii2d_search
    res = await asyncio.gather(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\data_source\ascii2d.py", line 52, in get_final_res
    thumbnail = await get_image_bytes_by_url(r.thumbnail)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\asyncio\__init__.py", line 189, in async_wrapped
    return await copy(fn, *args, **kwargs)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\asyncio\__init__.py", line 111, in __call__
    do = await self.iter(retry_state=retry_state)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\asyncio\__init__.py", line 153, in iter
    result = await action(retry_state)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\_utils.py", line 99, in inner
    return call(*args, **kwargs)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\__init__.py", line 418, in exc_check
    raise retry_exc.reraise()
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\__init__.py", line 185, in reraise
    raise self.last_attempt.result()
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\_base.py", line 449, in result
    return self.__get_result()
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\asyncio\__init__.py", line 114, in __call__
    result = await fn(*args, **kwargs)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\utils.py", line 72, in get_image_bytes_by_url
    resp = await session.get(url)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_client.py", line 1801, in get
    return await self.request(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_client.py", line 1574, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_client.py", line 1661, in send
    response = await self._send_handling_auth(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_client.py", line 1689, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_client.py", line 1726, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_client.py", line 1763, in _send_single_request
    response = await transport.handle_async_request(request)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_transports\default.py", line 372, in handle_async_request
    with map_httpcore_exceptions():
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_transports\default.py", line 86, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError
09-17 05:32:21 [INFO] nonebot | Matcher(type='message', module=YetAnotherPicSearch.__main__, lineno=332) running complete
09-17 05:32:21 [SUCCESS] nonebot | OneBot V11 2040209149 | [message_sent]: {'time': 1726522340, 'self_id': 2040209149, 'post_type': 'message_sent', 'user_id': 2040209149, 'sub_type': 'friend', 'message_seq': -2147475359, 'raw_message': '[CQ:reply,id=-2147475370]第 1 张图搜索失 败', 'message_id': -2147475359, 'font': 14, 'message_type': 'private', 'message_format': 'array', 'target_id': 1925477085, 'message': [{'data': {'id': '-2147475370'}, 'type': 'reply'}, {'data': {'text': '第 1 张图搜索失败'}, 'type': 'text'}], 'real_id': -2147475359, 'sender': {'user_id': 2040209149, 'nickname': '斗魂骇客', 'card': ''}}

@XieXiLin2
Copy link

感谢回复!我这次更新了插件并按教程配置了workers,但我的浏览器能访问中转的地址,插件却访问不了 实现端是llonebot QQ截图20240917054549

QQ截图20240917053844

0A6DBA4FB3AAE354E2E7111C63411814

09-17 05:32:07 [SUCCESS] nonebot | OneBot V11 2040209149 | [message_sent]: {'time': 1726522326, 'self_id': 2040209149, 'post_type': 'message_sent', 'user_id': 2040209149, 'sub_type': 'friend', 'message_seq': -2147475362, 'raw_message': '[CQ:json,data={"app":"com.tencent.multimsg"&#44;"config":{"autosize":1&#44;"forward":1&#44;"round":1&#44;"type":"normal"&#44;"width":300}&#44;"desc":"&#91;聊天记录&#93;"&#44;"extra":"{\\"filename\\":\\"MultiMsg\\"&#44;\\"tsum\\":2}\\n"&#44;"meta":{"detail":{"news":&#91;{"text":"斗魂骇客: SauceNAO (50.67%)\\n&#91;图片&#93;\\nRecovery\\n作者:&#91;OokamiLokester&#93;(http://ookam"}&#44;{"text":"斗魂骇客: 相似度 50.67% 过低,自动使用 Ascii2D 进行搜索"}&#93;&#44;"resid":""&#44;"source":"斗魂骇客的聊天记录"&#44;"summary":"查看2条转发消息"&#44;"uniseq":"MultiMsg"}}&#44;"prompt":"&#91;聊天记录&#93;"&#44;"ver":"0.0.0.5"&#44;"view":"contact"}\n]', 'message_id': -2147475362, 'font': 14, 'message_type': 'private', 'message_format': 'array', 'target_id': 1925477085, 'message': [{'data': {'data': '{"app":"com.tencent.multimsg","config":{"autosize":1,"forward":1,"round":1,"type":"normal","width":300},"desc":"[聊天记录]","extra":"{\\"filename\\":\\"MultiMsg\\",\\"tsum\\":2}\\n","meta":{"detail":{"news":[{"text":" 斗魂骇客: SauceNAO (50.67%)\\n[图片]\\nRecovery\\n作者:[OokamiLokester](http://ookam"},{"text":"斗魂骇客: 相似度 50.67% 过低,自动使用 Ascii2D 进行搜索"}],"resid":"","source":"斗魂骇客的聊天记录","summary":"查看2条转发消息","uniseq":"MultiMsg"}},"prompt":"[聊天记录]","ver":"0.0.0.5","view":"contact"}\n'}, 'type': 'json'}], 'real_id': -2147475362, 'sender': {'user_id': 2040209149, 'nickname': '斗魂骇客', 'card': ''}}
09-17 05:32:21 [ERROR] YetAnotherPicSearch | Error occurred
Traceback (most recent call last):
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_transports\default.py", line 69, in map_httpcore_exceptions
    yield
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_transports\default.py", line 373, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpcore\_async\connection_pool.py", line 216, in handle_async_request
    raise exc from None
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpcore\_async\connection_pool.py", line 196, in handle_async_request
    response = await connection.handle_async_request(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpcore\_async\http_proxy.py", line 317, in handle_async_request
    stream = await stream.start_tls(**kwargs)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpcore\_async\http11.py", line 383, in start_tls
    return await self._stream.start_tls(ssl_context, server_hostname, timeout)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpcore\_backends\anyio.py", line 68, in start_tls
    with map_exceptions(exc_map):
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 17, in <module>
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\__init__.py", line 335, in run
    get_driver().run(*args, **kwargs)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run
    uvicorn.run(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\uvicorn\main.py", line 577, in run
    server.run()
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\uvicorn\server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\windows_events.py", line 322, in run_forever
    super().run_forever()
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 641, in run_forever
    self._run_once()
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 1987, in _run_once
    handle._run()
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\asyncio\events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\internal\matcher\matcher.py", line 850, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\internal\matcher\matcher.py", line 825, in simple_run
    await handler(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\nonebot\dependencies\__init__.py", line 94, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\__main__.py", line 317, in search_handler
    async with fail_with_msg(
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 231, in __aexit__
    await self.gen.athrow(value)
> File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\__main__.py", line 150, in fail_with_msg
    yield
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\__main__.py", line 321, in search_handler
    await handle_single_image(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\__main__.py", line 291, in handle_single_image
    res = await func(file, client, mode)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\utils.py", line 231, in wrapper
    result = await func(*args, **kwargs)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\data_source\ascii2d.py", line 33, in ascii2d_search
    res = await asyncio.gather(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\data_source\ascii2d.py", line 52, in get_final_res
    thumbnail = await get_image_bytes_by_url(r.thumbnail)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\asyncio\__init__.py", line 189, in async_wrapped
    return await copy(fn, *args, **kwargs)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\asyncio\__init__.py", line 111, in __call__
    do = await self.iter(retry_state=retry_state)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\asyncio\__init__.py", line 153, in iter
    result = await action(retry_state)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\_utils.py", line 99, in inner
    return call(*args, **kwargs)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\__init__.py", line 418, in exc_check
    raise retry_exc.reraise()
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\__init__.py", line 185, in reraise
    raise self.last_attempt.result()
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\_base.py", line 449, in result
    return self.__get_result()
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\tenacity\asyncio\__init__.py", line 114, in __call__
    result = await fn(*args, **kwargs)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\YetAnotherPicSearch\utils.py", line 72, in get_image_bytes_by_url
    resp = await session.get(url)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_client.py", line 1801, in get
    return await self.request(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_client.py", line 1574, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_client.py", line 1661, in send
    response = await self._send_handling_auth(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_client.py", line 1689, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_client.py", line 1726, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_client.py", line 1763, in _send_single_request
    response = await transport.handle_async_request(request)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_transports\default.py", line 372, in handle_async_request
    with map_httpcore_exceptions():
  File "C:\Users\Cyber\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "F:\nonebot\FF_Bot\.venv\Lib\site-packages\httpx\_transports\default.py", line 86, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError
09-17 05:32:21 [INFO] nonebot | Matcher(type='message', module=YetAnotherPicSearch.__main__, lineno=332) running complete
09-17 05:32:21 [SUCCESS] nonebot | OneBot V11 2040209149 | [message_sent]: {'time': 1726522340, 'self_id': 2040209149, 'post_type': 'message_sent', 'user_id': 2040209149, 'sub_type': 'friend', 'message_seq': -2147475359, 'raw_message': '[CQ:reply,id=-2147475370]第 1 张图搜索失 败', 'message_id': -2147475359, 'font': 14, 'message_type': 'private', 'message_format': 'array', 'target_id': 1925477085, 'message': [{'data': {'id': '-2147475370'}, 'type': 'reply'}, {'data': {'text': '第 1 张图搜索失败'}, 'type': 'text'}], 'real_id': -2147475359, 'sender': {'user_id': 2040209149, 'nickname': '斗魂骇客', 'card': ''}}

要么检查网络连接;要么就是你连不上你的 CF Workers。

我清楚记得 workers.dev 在国内是 BLOCKED 状态,建议套一层域名解析来使用。

@NekoAria
Copy link
Collaborator

感谢回复!我这次更新了插件并按教程配置了workers,但我的浏览器能访问中转的地址,插件却访问不了 实现端是llonebot

这个问题很可能是因为你安装的 PicImageSearch 版本不是 v3.10.9 或最新的 v3.10.10。

因为 v3.10.9 版本才修复了 ascii2d 在配置了 base_url 的情况下对缩略图的解析逻辑。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants