Giter Site home page Giter Site logo

blivedm's People

Contributors

brainbush avatar dependabot[bot] avatar kinorin avatar nilknow avatar no1xsyzy avatar tomatopuddin avatar xfgryujk avatar

Stargazers

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

Watchers

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

blivedm's Issues

代码重构后线程使用数飙升

在使用了重构后的代码后发现,每秒处理新消息时都新建了一个线程,并所有线程都没有关闭。这就导致了并发情况下会使得线程使用量大量上升,运行久了甚至会使服务器线程占满

为保护用户隐私,未注册登陆用户将无法查看他人昵称

B站最近更新了隐私政策,直播监听5分钟左右,会提示‘为保护用户隐私,未注册登陆用户将无法查看他人昵称’,所有用户UID都为0了,大佬能解决一下吗?
room_id=24697117 unknown cmd=LOG_IN_NOTICE, command={'cmd': 'LOG_IN_NOTICE', 'data': {'notice_msg': '为保护用户隐私,未注册登陆用户将无法查看他人昵称', 'image_web': 'http://i0.hdslb.com/bfs/dm/75e7c16b99208df259fe0a93354fd3440cbab412.png', 'image_app': ''}}

关于版权问题

https://github.com/yjqiang/danmu
这份代码是 fork 自本项目,但我最近有计划将其打包至 pypi。
license 显示为你的名字我还没改,但是你可以看到基本上这份代码与你的代码没有什么关系了,如果不修改 license 应该很奇怪吧,pypi 里面作者是我, 许可名字却是你。
所以想问一下,如果我打包的话,可否把版权时间 Copyright (c) 2018 xfgryujk 这里,fork你的时间之前,代码版权归你,之后到现在,版权归我。

项目还更新么?

非常感谢此项目带来的帮助。我在本项目基础上,得以做了很多事情。现在我把websocket封装了起来。但是不太想单独做一个项目了。所以就考虑重新反馈到你这里。所以想问一下你这里还更新么

cmd可能发生变化,包数据解析可能存在遗漏

经过几天的使用,发现通过ws发送过来的消息可能发生了变化。比如,用户进入直播间已经无法捕捉到WELCOME命令,转而成为了INTERACT_WORD
而原先当直播间关注人数发生变化时,会产生ROOM_REAL_TIME_MESSAGE_UPDATE,现在已经无法接收到该命令(但是在网页端与手机app端,仍然可以观察到xxx关注了直播间这样的消息),所以包数据的解析可能存在遗漏。

ssl处理逻辑

忽略ssl证书是一种不安全的行为,所以还不如抛弃ssl,使用2244接口

ssl问题

class 'ssl.SSLError'> [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)

这个很诡异 因为电脑上的chrome正常使用 但是脚本运行就ssl错误,试了好几个电脑了

可以发送弹幕吗?

PC网页直接看直播卡,但是如果获取直播源然后用播放器打开就不卡,问题这样不支持弹幕,blivedm可以显示弹幕,问题是blivedm可以发送弹幕吗?

几个小细节

  1. https://github.com/xfgryujk/blivedm/blob/master/blivedm.py#L387 这里需要加一个 timeout,否则可能在网络 GG 的时候没什么提示就凉了,完全无法感知。由于心跳的机制,这个时间限制可以是 30 秒左右。
  2. 主协程这里其实很奇怪,心跳等可能也会发生失败等,这时也需要自己监控到并且重启。你这样把接收写在主协程,可能还是无法及时感知网络断开等问题。

谢谢开源!

这个仓库的代码真的帮助到我了,希望能够持续更新,感谢您的开源

疑似web接口新版弹幕消息

最近有一些不兼容的弹幕消息报错,暂时没空研究,先记一下

{'cmd': 'DANMU_MSG:3:7:1:1:1:1', 'info': [
[0, 7, 100, 16777215, 1701789809186, 0, 0, 'f4dbdf21', 0, None, None, None, 0, '{}', '{}', {'mode': 0, 'show_player_type': 0, 'extra': '{"mode":0,"send_from_me":false,"color":16777215,"dm_type":0,"font_size":100,"player_mode":7,"content":"[1.0,0.0,\\"0.8-0.5\\",10.0,\\"辛苦了\\",0.0,0.0,0.0,0.0,10000,0,true,\\"黑体\\",1]"}'}, None, None],
'[1.0,0.0,"0.8-0.5",10.0,"辛苦了",0.0,0.0,0.0,0.0,10000,0,true,"黑体",1]', [0, '***', 1, 0, 0, 10000, 1, ''], None, [], [], 0, 0, None, {'ts': 1701789809, 'ct': '8DB3B1FF'}, 0, 0, None, None, 0, 0, [0]
], 'dm_v2': ''}

{'cmd': 'DANMU_MSG:3:7:1:1:1:1', 'info': [
[0, 7, 100, 16777215, 1701789899411, 0, 0, 'f4dbdf21', 0, None, None, None, 0, '{}', '{}', {'mode': 0, 'show_player_type': 0, 'extra': '{"mode":0,"send_from_me":false,"color":16777215,"dm_type":0,"font_size":100,"player_mode":7,"content":"[1.0,0.0,\\"0.8-0.5\\",10.0,\\"晚安\\",0.0,0.0,0.0,0.0,10000,0,true,\\"黑体\\",1]"}'}, None, None],
'[1.0,0.0,"0.8-0.5",10.0,"晚安",0.0,0.0,0.0,0.0,10000,0,true,"黑体",1]', [0, '***', 1, 0, 0, 10000, 1, ''], None, [], [], 0, 0, None, {'ts': 1701789899, 'ct': '8045F9DF'}, 0, 0, None, None, 0, 0, [0]
], 'dm_v2': ''}

{'cmd': 'DANMU_MSG:3:7:1:1:1:1', 'info': [
[0, 7, 100, 16777215, 1701866650320, 0, 0, 'f4dbdf21', 0, None, None, None, 0, '{}', '{}', {'mode': 0, 'show_player_type': 0, 'extra': '{"mode":0,"send_from_me":false,"color":16777215,"dm_type":0,"font_size":100,"player_mode":7,"content":"[1.0,0.0,\\"0.8-0.5\\",10.0,\\"了不起\\",0.0,0.0,0.0,0.0,10000,0,true,\\"黑体\\",1]"}'}, None, None],
'[1.0,0.0,"0.8-0.5",10.0,"了不起",0.0,0.0,0.0,0.0,10000,0,true,"黑体",1]', [0, '***', 1, 0, 0, 10000, 1, ''], None, [], [], 0, 0, None, {'ts': 1701866650, 'ct': '6AA2F39E'}, 0, 0, None, None, 0, 0, [0]
], 'dm_v2': ''}

控制台报错 程序为sample.py

python 3.8 ubuntu 20.04 直播间弹幕无肉眼可见异常

await self._ws.send_bytes(packman.pack(heartbeat(), Operation.HEARTBEAT))
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/client_ws.py", line 156, in send_bytes
    await self._writer.send(data, binary=True, compress=compress)
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 688, in send
    await self._send_frame(message, WSMsgType.BINARY, compress)
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 601, in _send_frame
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport
Job "BLiver.heartbeat (trigger: interval[0:00:30], next run at: 2022-02-18 00:14:06 CST)" raised an exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
    retval = await job.func(*job.args, **job.kwargs)
  File "/usr/local/lib/python3.8/dist-packages/blive/framework.py", line 147, in heartbeat
    await self._ws.send_bytes(packman.pack(heartbeat(), Operation.HEARTBEAT))
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/client_ws.py", line 156, in send_bytes
    await self._writer.send(data, binary=True, compress=compress)
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 688, in send
    await self._send_frame(message, WSMsgType.BINARY, compress)
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 601, in _send_frame
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport
Job "BLiver.heartbeat (trigger: interval[0:00:30], next run at: 2022-02-18 00:14:36 CST)" raised an exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
    retval = await job.func(*job.args, **job.kwargs)
  File "/usr/local/lib/python3.8/dist-packages/blive/framework.py", line 147, in heartbeat
    await self._ws.send_bytes(packman.pack(heartbeat(), Operation.HEARTBEAT))
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/client_ws.py", line 156, in send_bytes
    await self._writer.send(data, binary=True, compress=compress)
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 688, in send
    await self._send_frame(message, WSMsgType.BINARY, compress)
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 601, in _send_frame
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport
Job "BLiver.heartbeat (trigger: interval[0:00:30], next run at: 2022-02-18 00:15:06 CST)" raised an exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
    retval = await job.func(*job.args, **job.kwargs)
  File "/usr/local/lib/python3.8/dist-packages/blive/framework.py", line 147, in heartbeat
    await self._ws.send_bytes(packman.pack(heartbeat(), Operation.HEARTBEAT))
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/client_ws.py", line 156, in send_bytes
    await self._writer.send(data, binary=True, compress=compress)
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 688, in send
    await self._send_frame(message, WSMsgType.BINARY, compress)
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 601, in _send_frame
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport
^CTraceback (most recent call last):
  File "main.py", line 44, in <module>
    app.run()
  File "/usr/local/lib/python3.8/dist-packages/blive/framework.py", line 176, in run
    loop.run_forever()
  File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
    self._run_once()
  File "/usr/lib/python3.8/asyncio/base_events.py", line 1823, in _run_once
    event_list = self._selector.select(timeout)
  File "/usr/lib/python3.8/selectors.py", line 468, in select
    fd_event_list = self._selector.poll(timeout, max_ev)

房间白名单限制

我在尝试连接他人直播间的时候有bilibili返回报错白名单限制,请问这个限制的机制是什么样的,blivechat连接其他主播似乎也没有被限制?

开放平台报错 blivedm.clients.ws_base.InitError: init_room() failed

 2024-03-21 10:56:57 - e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\open_live.py[line:172] - ERROR: _start_game() failed:
Traceback (most recent call last):
  File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\open_live.py", line 157, in _start_game
    async with self._request_open_live(
  File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\aiohttp\client.py", line 1167, in __aenter__
    self._resp = await self._coro
  File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\aiohttp\client.py", line 493, in _request
    with timer:
  File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\aiohttp\helpers.py", line 725, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
2024-03-21 10:56:57 - e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\ws_base.py[line:248] - ERROR: room=None _network_coroutine() finished with exception:
Traceback (most recent call last):
  File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\ws_base.py", line 243, in _network_coroutine_wrapper
    await self._network_coroutine()
  File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\ws_base.py", line 264, in _network_coroutine
    await self._on_before_ws_connect(retry_count)
  File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\open_live.py", line 271, in _on_before_ws_connect
    await super()._on_before_ws_connect(retry_count)
  File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\ws_base.py", line 306, in _on_before_ws_connect
    raise InitError('init_room() failed')
blivedm.clients.ws_base.InitError: init_room() failed

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.