Code Monkey home page Code Monkey logo

biligpthelper's Introduction

Hi there, I'm Roitium👋

I am Roitium (or yanyao2333, whatever), a self taught developer.

Coding with ❤

yanyao's Github stats

biligpthelper's People

Contributors

fossabot avatar pawnzzi avatar yanyao2333 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

biligpthelper's Issues

cookie刷新失败的问题找到了

requirements.txt中bilibili-api-python依赖替换成bilibili-api-dev就可以了。这个项目分支解决了这个问题,开发者的代码少了个右括号

新版本还在开发嘛?

最近闲下来了,看下下代码,好多都重构了,是还在重构中嘛?
把代码clone下来,好几个地方都在报错。好几处bug。

程序日志显示评论发送成功,但实际上bilibili里没有评论

发现两个问题:
1-同一个视频要第二次at才会发送评论、首次at只会写进缓存不会发送评论,第二次之后的at就去缓存读取数据发送了。
2-评论发送成功,调用发送评论接口成功了,拿到正确的响应,但是视频的评论中没有这条评论,不知道是不是阿b秒删,还是程序问题。

项目启动起来了,

目前遇到几个问题:
第一个报错:
Job "Session.run.<locals>.qurey (trigger: interval[0:00:06], next run at: 2024-02-17 14:49:17 CST)" raised an exception Traceback (most recent call last): File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\apscheduler\executors\base_py3.py", line 30, in run_coroutine_job retval = await job.func(*job.args, **job.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\bilibili_api\session.py", line 502, in qurey js: dict = await new_sessions(self.credential, self.maxTs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\bilibili_api\session.py", line 79, in new_sessions return await Api(**api, credential=credential).update_params(**params).result ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\bilibili_api\utils\network.py", line 273, in result self.__result = await self.request() ^^^^^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\bilibili_api\utils\network.py", line 173, in inner return await func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\bilibili_api\utils\network.py", line 553, in request async with session.request(**config) as resp: File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\aiohttp\client.py", line 1194, in __aenter__ self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\aiohttp\client.py", line 605, in _request await resp.start(conn) File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\aiohttp\client_reqrep.py", line 966, in start message, payload = await protocol.read() # type: ignore[union-attr] ^^^^^^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\aiohttp\streams.py", line 622, in read await self._waiter aiohttp.client_exceptions.ClientOSError: [WinError 10053] 你的主机中的软件中止了一个已建立的连接。
项目启动之后会一直循环报这个错,疑似新版bilibiliapi的问题?

第二个报错:bili_linsten.py文件中
for item in reversed(data["items"]): if item["at_time"] > self.last_at_time: _LOGGER.debug(f"at_time{item['at_time']}大于last_at_time{self.last_at_time},放入新消息队列") item["user"] = data["items"]["user"] new_items.append(item)
item["user"] = data["items"]["user"] 这行代码应该注释掉吧?不然逻辑不通,不注释也会报错。

第三个报错:bili_linsten.py文件中
原代码:
`async def build_task_from_at_msg(self, msg: dict) -> BiliGPTTask | None:
try:
event = deepcopy(msg)
if msg["type"] != "reply" or msg["business_id"] != 1:
_LOGGER.warning("不是回复消息,跳过")
return None
elif msg["item"]["root_id"] == 0 and msg["item"]["target_id"] == 0:
_LOGGER.warning("该消息是楼中楼消息,暂时不受支持,跳过处理")
return None
event["source_type"] = "bili_comment"
event["raw_task_data"] = deepcopy(msg)
event["source_extra_attr"] = BiliAtSpecialAttributes.model_validate(event)
event["sender_id"] = event["user"]["mid"]
event["video_url"] = event["uri"]
event["source_command"] = event["source_content"]
event["video_id"] = await BiliVideo(url=event["uri"]).bvid
task_metadata = BiliGPTTask.model_validate(event)
except Exception:
traceback.print_exc()
_LOGGER.error("在验证任务数据结构时出现错误,跳过处理!")
return None

    return task_metadata`

本地修改后:
` async def build_task_from_at_msg(self, msg: dict) -> BiliGPTTask | None:
try:
event = deepcopy(msg)
if msg["item"]["type"] != "reply" or msg["item"]["business_id"] != 1:
_LOGGER.warning("不是回复消息,跳过")
return None
elif msg["item"]["root_id"] != 0 or msg["item"]["target_id"] != 0:
_LOGGER.warning("该消息是楼中楼消息,暂时不受支持,跳过处理")
return None
event["source_type"] = "bili_comment"
event["raw_task_data"] = deepcopy(msg)
event["source_extra_attr"] = BiliAtSpecialAttributes.model_validate(event["item"])
event["sender_id"] = str(event["user"]["mid"])
event["video_url"] = event["item"]["uri"]
event["source_command"] = event["item"]["source_content"]
event["video_id"] = await BiliVideo(credential=self.credential, url=event["item"]["uri"]).bvid
task_metadata = BiliGPTTask.model_validate(event)
except Exception as e:
traceback.print_exc()
_LOGGER.error(e)
_LOGGER.error("在验证任务数据结构时出现错误,跳过处理!")
return None

    return task_metadata`

这个是我本地修改之后的代码,第二个问题的循环结束后会调用这个方法,参数是new_items循环的item
结合上面的逻辑所以好几处的值都是在event['item']中,楼中楼的判断值不等0才是。
但是修改完后执行到event["video_id"] = await BiliVideo(credential=self.credential, url=event["item"]["uri"]).bvid的时候直接捕获异常了,提示请求超时。
以上是遇到的几个问题,能启动,但是跑不通。都是在调用bilibliapi时报错,不知道是新版本的api问题还是账号问题,晚些换个账号再测试下。不清楚你的逻辑,上述问题是否存在我所说的bug,如是,我晚些提个PR

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.