lgc-NB2Dev / nonebot-plugin-bawiki

A nonebot2 plugin for Blue Archive.
MIT License
82 stars 6 forks source link

功能经常报错有时又能用 #45

Closed Rod-fish closed 1 year ago

Rod-fish commented 1 year ago
Traceback (most recent call last):
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 164, in try_connect
    stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1691, in connect_tcp
    await get_running_loop().create_connection(
  File "uvloop/loop.pyx", line 2039, in create_connection
    raise exceptions[0]
  File "uvloop/loop.pyx", line 2016, in uvloop.loop.Loop.create_connection
    await waiter
ConnectionRefusedError: [Errno 111] Connection refused

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

Traceback (most recent call last):
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
    yield
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 111, in connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 222, in connect_tcp
    raise OSError("All connection attempts failed") from cause
OSError: All connection attempts failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
    yield
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request
    raise exc
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(request)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpcore/_async/http_proxy.py", line 261, in handle_async_request
    connect_response = await self._connection.handle_async_request(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpcore/_async/connection.py", line 86, in handle_async_request
    raise exc
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpcore/_async/connection.py", line 63, in handle_async_request
    stream = await self._connect(request)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpcore/_async/connection.py", line 111, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpcore/backends/auto.py", line 29, in connect_tcp
    return await self._backend.connect_tcp(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 111, in connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File "/usr/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc)
httpcore.ConnectError: All connection attempts failed

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

Traceback (most recent call last):
  File "/home/my/bot/zhenxun_bot/bot.py", line 22, in <module>
    nonebot.run()
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/__init__.py", line 273, in run
    get_driver().run(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/drivers/fastapi.py", line 172, in run
    uvicorn.run(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/uvicorn/main.py", line 578, in run
    server.run()
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/uvicorn/server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/message.py", line 142, in _check_matcher
    await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
> File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/message.py", line 188, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 727, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 702, in simple_run
    await handler(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/dependencies/__init__.py", line 108, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/command/global_future.py", line 56, in _
    await matcher.finish(await db_global_future(all_img=True))
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/bawiki.py", line 163, in db_global_future
    data = (await db_get_wiki_data())["global_future"]
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/bawiki.py", line 28, in db_get_wiki_data
    return await db_get("data/wiki.json")
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/bawiki.py", line 24, in db_get
    return await async_req(f"{config.ba_bawiki_db_url}{suffix}", raw=raw)  # type: ignore
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/util.py", line 131, in async_req
    resp = await cli.request(method, url, params=params, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpx/_client.py", line 1533, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpx/_client.py", line 1620, in send
    response = await self._send_handling_auth(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpx/_client.py", line 1648, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpx/_client.py", line 1685, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpx/_client.py", line 1722, in _send_single_request
    response = await transport.handle_async_request(request)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/usr/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: All connection attempts failed

在使用千里眼和查漫画等功能经常出现这样的报错,我想问一下这里是网络问题导致还是什么

lgc2333 commented 1 year ago

可能是CDN使用的 域名SSL证书 / 域名本身 到期了,建议参考 文档 挂上代理并换源使用

Rod-fish commented 1 year ago

可能是CDN使用的 域名SSL证书 / 域名本身 到期了,建议参考 文档 挂上代理并换源使用

9b445227c0293301df6d10fd30960f85

实际上我这边已经按照文档挂上代理了,但是还是经常无法使用的

Rod-fish commented 1 year ago

换个办法,我在自己本地启了个服务把db数据拉下来用了,插件已添加署名数据来源于你的项目,感谢大佬

Rod-fish commented 1 year ago

话说我还有个问题,wiki.gamekee.com站点好像更新了?目前无法获取l2d图片、学生wiki、漫画,大佬什么时候看一下?(狗头

l2d目前只能发送文字,图片全部发不出来 117afb556efd997154b31cdd28fb4631_720

以下是漫画触发的错误

09-03 01:29:31 [ERROR] nonebot_plugin_bawiki | 获取漫画失败
Traceback (most recent call last):
  File "/home/my/bot/zhenxun_bot/bot.py", line 22, in <module>
    nonebot.run()
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/__init__.py", line 273, in run
    get_driver().run(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/drivers/fastapi.py", line 172, in run
    uvicorn.run(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/uvicorn/main.py", line 578, in run
    server.run()
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/uvicorn/server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/message.py", line 142, in _check_matcher
    await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/message.py", line 188, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 727, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 702, in simple_run
    await handler(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/dependencies/__init__.py", line 108, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
> File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/command/manga.py", line 81, in _
    content = await get_manga_content(manga.cid)
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 502, in get_manga_content
    content = tags_to_str(soup).strip()
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 487, in tags_to_str
    text = process(tag).strip()
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 480, in process
    return "".join([s for x in c if (s := process(x))])
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 480, in <listcomp>
    return "".join([s for x in c if (s := process(x))])
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 480, in process
    return "".join([s for x in c if (s := process(x))])
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 480, in <listcomp>
    return "".join([s for x in c if (s := process(x))])
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 480, in process
    return "".join([s for x in c if (s := process(x))])
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 480, in <listcomp>
    return "".join([s for x in c if (s := process(x))])
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 480, in process
    return "".join([s for x in c if (s := process(x))])
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 480, in <listcomp>
    return "".join([s for x in c if (s := process(x))])
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 480, in process
    return "".join([s for x in c if (s := process(x))])
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 480, in <listcomp>
    return "".join([s for x in c if (s := process(x))])
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 481, in process
    if s := elem.text.strip().replace("\u200b", ""):
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/bs4/element.py", line 921, in __getattr__
    raise AttributeError(
AttributeError: 'NavigableString' object has no attribute 'text'

以下是ba学生wiki触发的错误

09-03 01:32:06 [ERROR] nonebot_plugin_bawiki | 截取wiki页面出错 https://ba.gamekee.com/46677.html
Traceback (most recent call last):
  File "/home/my/bot/zhenxun_bot/bot.py", line 22, in <module>
    nonebot.run()
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/__init__.py", line 273, in run
    get_driver().run(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/drivers/fastapi.py", line 172, in run
    uvicorn.run(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/uvicorn/main.py", line 578, in run
    server.run()
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/uvicorn/server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/message.py", line 142, in _check_matcher
    await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/message.py", line 188, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 727, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 702, in simple_run
    await handler(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/nonebot/dependencies/__init__.py", line 108, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/command/stu_wiki_gamekee.py", line 53, in _
    await send_wiki_page(sid, matcher)
> File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 127, in send_wiki_page
    img = await game_kee_get_page(url)
  File "/home/my/bot/zhenxun_bot/extensive_plugin/nonebot_plugin_bawiki/data/gamekee.py", line 108, in game_kee_get_page
    await page.evaluate(GAMEKEE_WIKI_PAGE_JS)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/playwright/async_api/_generated.py", line 8330, in evaluate
    await self._impl_obj.evaluate(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/playwright/_impl/_page.py", line 407, in evaluate
    return await self._main_frame.evaluate(expression, arg)
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/playwright/_impl/_frame.py", line 277, in evaluate
    await self._channel.send(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/playwright/_impl/_connection.py", line 44, in send
    return await self._connection.wrap_api_call(
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/playwright/_impl/_connection.py", line 419, in wrap_api_call
    return await cb()
  File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-XNwg48JX-py3.9/lib/python3.9/site-packages/playwright/_impl/_connection.py", line 79, in inner_send
    result = next(iter(done)).result()
playwright._impl._api_types.Error: TypeError: Cannot read properties of null (reading 'style')
    at eval (eval at evaluate (:197:30), <anonymous>:9:50)
    at UtilityScript.evaluate (<anonymous>:204:19)
    at UtilityScript.<anonymous> (<anonymous>:1:44)