Closed leekooyo closed 3 weeks ago
解析小程序时会报错误码: -400, 信息: 请求错误
解析小程序时会报错误码: -400, 信息: 请求错误
能否提供一下详细的信息,我试验过安卓版本和HD版本的b站转发没有问题
日志如下
`02-13 16:58:25 [ERROR] nonebot | Running Matcher(type='message', module=plugins.bilibiliParse) failed.
Traceback (most recent call last):
File "/home/pc/桌面/zhenxun_bot-main/bot.py", line 21, in
File "/home/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-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/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-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/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-py3.10/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 702, in simple_run await handler( File "/home/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-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/pc/桌面/zhenxun_bot-main/plugins/bilibiliParse/init.py", line 120, in msgParse vd_info, live_info, vd_url, live_url, image_info, image_url = await parse_bili_url(get_url, information_container) File "/home/pc/桌面/zhenxun_bot-main/plugins/bilibiliParse/parse_bili_url.py", line 39, in parse_bili_url vd_info = await video.get_video_base_info(vid) File "/home/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-py3.10/lib/python3.10/site-packages/bilireq/video/init.py", line 11, in get_video_base_info return await get(url, params=params) File "/home/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-py3.10/lib/python3.10/site-packages/bilireq/utils/init.py", line 167, in get return await request("GET", url, kwargs) File "/home/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-py3.10/lib/python3.10/site-packages/bilireq/utils/init.py", line 158, in request raise ResponseCodeError( bilireq.exceptions.ResponseCodeError: 错误码: -400, 信息: 请求错误 `
日志如下 `02-13 16:58:25 [ERROR] nonebot | Running Matcher(type='message', module=plugins.bilibiliParse) failed. Traceback (most recent call last): File "/home/pc/桌面/zhenxun_bot-main/bot.py", line 21, in
nonebot.run() File "/home/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-py3.10/lib/python3.10/site-packages/nonebot/init.py", line 273, in run get_driver().run(*args, **kwargs) File "/home/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-py3.10/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 172, in run uvicorn.run( File "/home/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-py3.10/lib/python3.10/site-packages/uvicorn/main.py", line 569, in run server.run() File "/home/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-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/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-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/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-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/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-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/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-py3.10/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 702, in simple_run await handler( File "/home/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-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/pc/桌面/zhenxun_bot-main/plugins/bilibiliParse/init.py", line 120, in msgParse vd_info, live_info, vd_url, live_url, image_info, image_url = await parse_bili_url(get_url, information_container) File "/home/pc/桌面/zhenxun_bot-main/plugins/bilibiliParse/parse_bili_url.py", line 39, in parse_bili_url vd_info = await video.get_video_base_info(vid) File "/home/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-py3.10/lib/python3.10/site-packages/bilireq/video/init.py", line 11, in get_video_base_info return await get(url, params=params) File "/home/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-py3.10/lib/python3.10/site-packages/bilireq/utils/init.py", line 167, in get return await request("GET", url, kwargs) File "/home/pc/.cache/pypoetry/virtualenvs/zhenxun-bot-PY0IqCSM-py3.10/lib/python3.10/site-packages/bilireq/utils/init.py", line 158, in request raise ResponseCodeError( bilireq.exceptions.ResponseCodeError: 错误码: -400, 信息: 请求错误 ` 提供一下你的b站版本和qq版本,不然只看日志没有办法复现
b站版本v7.66.0,qq版本9.0.17,gocq协议为8.9.78
b站版本v7.66.0,qq版本9.0.17,gocq协议为8.9.78
很遗憾,除了使用的协议不同(我使用的是shamrock,但应该不是协议的问题),其他相同条件下我都无法成功复现。
根据你提供的日志,目前可以确定是问题出现在bilireq。-400状态码有可能是b站的风控问题,例如短时间内请求过多导致。
我检查了我一个月内的error日志,并未发现-400的状态码。如果之后还出现这样的问题的话,我再尝试复现,目前来讲我这边是没有这种问题的。
bilireq=0.2.11版本及之前的会出现-400状态码,0.2.12版本无法使用报错如下
httpx.ConnectError: All connection attempts failed
bilireq=0.2.11版本及之前的会出现-400状态码,0.2.12版本无法使用报错如下
httpx.ConnectError: All connection attempts failed
你有修改过“pyproject.toml”中的文件吗,我的bilireq版本为0.2.3.post0,目前是没问题的,你可以试一试
修改pyyaml=6.0.1,添加strenum=0.4.12和requests=2.21.0,我去试试降级bilireq到0.2.3.post0 更新:降级到0.2.3.post0后没有再遇到-400的问题
现在可以解析QQ小程序及聊天记录中有关视频、直播、动态、专栏的内容。由于B站验证码原因,动态和专栏的截图可能会失败。