New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bilibili-live

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bilibili-live

哔哩哔哩直播间互动工具

  • 0.10.4
  • PyPI
  • Socket score

Maintainers
1

哔哩哔哩直播间互动工具

Author LICENSE python

特色

  • 基于asyncio,可以满足更加丰富的使用场景
  • 基于bilibili三代协议,支持brotli压缩算法,效率更高
  • 事件钩子部分使用泛型,开发更友好

安装

pip install bilibili-live

使用

首先创建事件处理器类,类需要继承BilibiliLiveEventHandler类,并重写需要监听的事件方法:

from bilibili_live.events import BilibiliLiveEventHandler, Danmu, Event

class MyEventHandler(BilibiliLiveEventHandler):
    def onDanmu(self, event: Event[Danmu]):
        # do something
        ...

具体支持的事件可以参考BilibiliLiveEventHandler类

完成后,创建BilibiliLive对象,并启动监听:

from bilibili_live import BilibiliLive

room_id = 2411716
# 此处房间号为短号,即用户直接可见的房间号
bilibiliLive = BilibiliLive()
bilibiliLive.schedule(MyEventHandler, room_id)
bilibiliLive.start()

需要退出时,可使用stop方法停止:

bilibiliLive.stop()

此时即开启了事件循环。此函数为异步(非阻塞函数)。

本模块基于asyncio设计。start函数为一个包装函数,其中创建了一个线程并包装了协程操作。如需要直接使用asyncio方式操作,可使用start_asyncio函数。

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc